Skip to content

Commit

Permalink
fix: radius algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Sep 2, 2022
1 parent 46a861a commit 4869bdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/theme/__tests__/token.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Theme', () => {
12: { radiusBase: 12, radiusLG: 14, radiusSM: 6, radiusXS: 2, radiusOuter: 6 },
14: { radiusBase: 14, radiusLG: 16, radiusSM: 7, radiusXS: 2, radiusOuter: 6 },
16: { radiusBase: 16, radiusLG: 16, radiusSM: 8, radiusXS: 2, radiusOuter: 6 },
20: { radiusBase: 20, radiusLG: 20, radiusSM: 10, radiusXS: 2, radiusOuter: 6 },
20: { radiusBase: 16, radiusLG: 16, radiusSM: 8, radiusXS: 2, radiusOuter: 6 },
};

Object.entries(radiusGroup).forEach(([base, result]) => {
Expand Down
6 changes: 3 additions & 3 deletions components/theme/themes/shared/genRadius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const genRadius = (
} else if (radiusBase < 16 && radiusBase >= 6) {
radiusLG = radiusBase + 2;
} else if (radiusBase >= 16) {
radiusLG = radiusBase;
radiusLG = 16;
}

// radiusSM
Expand All @@ -27,7 +27,7 @@ const genRadius = (
} else if (radiusBase < 16 && radiusBase >= 14) {
radiusSM = 7;
} else if (radiusBase >= 16) {
radiusSM = radiusBase / 2;
radiusSM = 8;
}

// radiusXS
Expand All @@ -45,7 +45,7 @@ const genRadius = (
}

return {
radiusBase,
radiusBase: radiusBase > 16 ? 16 : radiusBase,
radiusXS,
radiusSM,
radiusLG,
Expand Down

0 comments on commit 4869bdd

Please sign in to comment.