2022-05-09 22:20:07 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
|
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
2022-07-11 15:35:58 +08:00
|
|
|
import { resetComponent } from '../../style';
|
2020-10-23 10:09:31 +08:00
|
|
|
|
2022-04-08 00:18:31 +08:00
|
|
|
interface StatisticToken extends FullToken<'Statistic'> {
|
2022-03-16 12:02:52 +08:00
|
|
|
statisticTitleFontSize: number;
|
|
|
|
statisticContentFontSize: number;
|
|
|
|
statisticFontFamily: string;
|
|
|
|
}
|
|
|
|
|
2022-06-02 12:06:27 +08:00
|
|
|
const genStatisticStyle: GenerateStyle<StatisticToken> = (token: StatisticToken): CSSObject => {
|
|
|
|
const {
|
|
|
|
componentCls,
|
|
|
|
marginXXS,
|
|
|
|
padding,
|
2022-08-04 16:16:50 +08:00
|
|
|
colorTextDescription,
|
2022-06-02 12:06:27 +08:00
|
|
|
statisticTitleFontSize,
|
|
|
|
colorTextHeading,
|
|
|
|
statisticContentFontSize,
|
|
|
|
statisticFontFamily,
|
|
|
|
} = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}`]: {
|
|
|
|
...resetComponent(token),
|
|
|
|
[`${componentCls}-title`]: {
|
|
|
|
marginBottom: marginXXS,
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2022-06-02 12:06:27 +08:00
|
|
|
fontSize: statisticTitleFontSize,
|
2022-03-16 12:02:52 +08:00
|
|
|
},
|
2022-06-02 12:06:27 +08:00
|
|
|
|
|
|
|
[`${componentCls}-skeleton`]: {
|
|
|
|
paddingTop: padding,
|
2022-03-16 12:02:52 +08:00
|
|
|
},
|
2022-06-02 12:06:27 +08:00
|
|
|
|
|
|
|
[`${componentCls}-content`]: {
|
|
|
|
color: colorTextHeading,
|
|
|
|
fontSize: statisticContentFontSize,
|
|
|
|
fontFamily: statisticFontFamily,
|
|
|
|
[`${componentCls}-content-value`]: {
|
|
|
|
display: 'inline-block',
|
|
|
|
direction: 'ltr',
|
|
|
|
},
|
|
|
|
[`${componentCls}-content-prefix, ${componentCls}-content-suffix`]: {
|
|
|
|
display: 'inline-block',
|
|
|
|
},
|
|
|
|
[`${componentCls}-content-prefix`]: {
|
|
|
|
marginInlineEnd: marginXXS,
|
|
|
|
},
|
|
|
|
[`${componentCls}-content-suffix`]: {
|
|
|
|
marginInlineStart: marginXXS,
|
|
|
|
},
|
2022-03-16 12:02:52 +08:00
|
|
|
},
|
|
|
|
},
|
2022-06-02 12:06:27 +08:00
|
|
|
};
|
|
|
|
};
|
2022-03-16 12:02:52 +08:00
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2022-11-19 13:47:33 +08:00
|
|
|
export default genComponentStyleHook('Statistic', (token) => {
|
2022-06-02 12:06:27 +08:00
|
|
|
const { fontSizeHeading3, fontSize, fontFamily } = token;
|
|
|
|
|
2022-04-11 16:04:00 +08:00
|
|
|
const statisticToken = mergeToken<StatisticToken>(token, {
|
2022-06-02 12:06:27 +08:00
|
|
|
statisticTitleFontSize: fontSize,
|
|
|
|
statisticContentFontSize: fontSizeHeading3,
|
|
|
|
statisticFontFamily: fontFamily,
|
2022-04-11 16:04:00 +08:00
|
|
|
});
|
2022-04-08 00:18:31 +08:00
|
|
|
return [genStatisticStyle(statisticToken)];
|
|
|
|
});
|