2022-06-29 16:15:58 +08:00
|
|
|
import type { CommonMapToken, SeedToken } from '../../interface';
|
|
|
|
import genFontSizes from './genFontSizes';
|
2022-09-01 20:09:32 +08:00
|
|
|
import genRadius from './genRadius';
|
2022-06-29 16:15:58 +08:00
|
|
|
|
|
|
|
export default function genCommonMapToken(token: SeedToken): CommonMapToken {
|
2022-11-01 15:06:38 +08:00
|
|
|
const { motionUnit, motionBase, fontSize, borderRadius, lineWidth } = token;
|
2022-06-29 16:15:58 +08:00
|
|
|
|
2022-11-01 15:06:38 +08:00
|
|
|
const fontSizes = genFontSizes(fontSize);
|
2022-06-29 16:15:58 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
// motion
|
2022-10-25 17:04:36 +08:00
|
|
|
motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
|
2022-06-29 16:15:58 +08:00
|
|
|
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
|
2022-11-01 15:06:38 +08:00
|
|
|
...genRadius(borderRadius),
|
2022-06-29 16:15:58 +08:00
|
|
|
};
|
|
|
|
}
|