ant-design/components/theme/themes/shared/genCommonMapToken.ts
MadCcc 9f88c1238a
feat: token update (#38314)
* feat: token update

* chore: update test

* chore: lint

* chore: code clean

* test: update test case

* feat: radius token update

* fix: form size

* chore: fix steps style

* chore: code clean

* chore: update test case
2022-11-01 15:06:38 +08:00

27 lines
798 B
TypeScript

import type { CommonMapToken, SeedToken } from '../../interface';
import genFontSizes from './genFontSizes';
import genRadius from './genRadius';
export default function genCommonMapToken(token: SeedToken): CommonMapToken {
const { motionUnit, motionBase, fontSize, borderRadius, lineWidth } = token;
const fontSizes = genFontSizes(fontSize);
return {
// motion
motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
motionDurationMid: `${(motionBase + motionUnit * 2).toFixed(1)}s`,
motionDurationSlow: `${(motionBase + motionUnit * 3).toFixed(1)}s`,
// font
fontSizes: fontSizes.map(fs => fs.size),
lineHeights: fontSizes.map(fs => fs.lineHeight),
// line
lineWidthBold: lineWidth + 1,
// radius
...genRadius(borderRadius),
};
}