mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
46a861afff
* feat: radius token * test: add test case * feat: linear after 16 * test: more test case
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
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,
|
|
fontSizeBase,
|
|
sizeUnit,
|
|
sizeBaseStep,
|
|
gridUnit,
|
|
gridBaseStep,
|
|
radiusBase,
|
|
controlHeight,
|
|
lineWidth,
|
|
} = token;
|
|
|
|
const fontSizes = genFontSizes(fontSizeBase);
|
|
|
|
return {
|
|
// motion
|
|
motionDurationFast: `${(motionBase + motionUnit * 1).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),
|
|
|
|
// size
|
|
sizeSpaceSM: sizeUnit * (sizeBaseStep - 1),
|
|
sizeSpace: sizeUnit * sizeBaseStep,
|
|
sizeSpaceXS: sizeUnit * (sizeBaseStep - 2),
|
|
sizeSpaceXXS: sizeUnit * (sizeBaseStep - 3),
|
|
|
|
// grid
|
|
gridSpaceSM: gridUnit * (gridBaseStep - 1),
|
|
gridSpaceBase: gridUnit * gridBaseStep,
|
|
gridSpaceLG: gridUnit * (gridBaseStep + 1),
|
|
gridSpaceXL: gridUnit * (gridBaseStep + 2),
|
|
gridSpaceXXL: gridUnit * (gridBaseStep + 5),
|
|
|
|
// line
|
|
lineWidthBold: lineWidth + 1,
|
|
|
|
// radius
|
|
...genRadius(radiusBase),
|
|
|
|
// control
|
|
controlHeightSM: controlHeight * 0.75,
|
|
controlHeightXS: controlHeight * 0.5,
|
|
controlHeightLG: controlHeight * 1.25,
|
|
};
|
|
}
|