2022-03-16 12:02:52 +08:00
|
|
|
// deps-lint-skip-all
|
2022-05-09 22:20:07 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
|
|
|
import type { GenerateStyle, FullToken } from '../../_util/theme';
|
|
|
|
import { resetComponent, genComponentStyleHook, mergeToken } from '../../_util/theme';
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
const genStatisticStyle: GenerateStyle<StatisticToken> = (token: StatisticToken): CSSObject => ({
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}`]: {
|
2022-03-16 12:02:52 +08:00
|
|
|
...resetComponent(token),
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}-title`]: {
|
2022-03-16 12:02:52 +08:00
|
|
|
marginBottom: token.marginXXS,
|
2022-03-22 13:26:29 +08:00
|
|
|
color: token.colorTextSecondary,
|
2022-03-16 12:02:52 +08:00
|
|
|
fontSize: token.statisticTitleFontSize,
|
|
|
|
},
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}-content`]: {
|
2022-03-22 20:02:04 +08:00
|
|
|
color: token.colorTextHeading,
|
2022-03-16 12:02:52 +08:00
|
|
|
fontSize: token.statisticContentFontSize,
|
|
|
|
fontFamily: token.statisticFontFamily,
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}-content-value`]: {
|
2022-03-16 12:02:52 +08:00
|
|
|
display: 'inline-block',
|
|
|
|
direction: 'ltr',
|
|
|
|
},
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}-content-prefix, ${token.componentCls}-content-suffix`]: {
|
2022-03-16 12:02:52 +08:00
|
|
|
display: 'inline-block',
|
|
|
|
},
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}-content-prefix`]: {
|
2022-03-16 12:02:52 +08:00
|
|
|
marginInlineStart: 4, // FIXME: hard code
|
|
|
|
},
|
2022-04-08 00:18:31 +08:00
|
|
|
[`${token.componentCls}-content-suffix`]: {
|
2022-03-16 12:02:52 +08:00
|
|
|
marginInlineEnd: 4, // FIXME: hard code
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2022-04-08 00:18:31 +08:00
|
|
|
export default genComponentStyleHook('Statistic', token => {
|
2022-04-11 16:04:00 +08:00
|
|
|
const statisticToken = mergeToken<StatisticToken>(token, {
|
2022-03-16 12:02:52 +08:00
|
|
|
statisticTitleFontSize: token.fontSize,
|
|
|
|
statisticContentFontSize: 24, // FIXME: hard code
|
|
|
|
statisticFontFamily: token.fontFamily,
|
2022-04-11 16:04:00 +08:00
|
|
|
});
|
2022-04-08 00:18:31 +08:00
|
|
|
return [genStatisticStyle(statisticToken)];
|
|
|
|
});
|