mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 09:21:22 +08:00
b967f9eb81
* chore: rm disabled color * chore: color heading * chore: shows tokn * chore: fix color mapping * chore: status colors * chore: durations * chore: outline color * chore: comment info * chore: background color * chore: merge nexr
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
// deps-lint-skip-all
|
|
import { CSSObject } from '@ant-design/cssinjs';
|
|
import {
|
|
useStyleRegister,
|
|
useToken,
|
|
resetComponent,
|
|
GenerateStyle,
|
|
UseComponentStyleResult,
|
|
} from '../../_util/theme';
|
|
import type { DerivativeToken } from '../../_util/theme';
|
|
|
|
interface StatisticToken extends DerivativeToken {
|
|
statisticCls: string;
|
|
statisticTitleFontSize: number;
|
|
statisticContentFontSize: number;
|
|
statisticFontFamily: string;
|
|
}
|
|
|
|
const genStatisticStyle: GenerateStyle<StatisticToken> = (token: StatisticToken): CSSObject => ({
|
|
[`${token.statisticCls}`]: {
|
|
...resetComponent(token),
|
|
[`${token.statisticCls}-title`]: {
|
|
marginBottom: token.marginXXS,
|
|
color: token.colorTextSecondary,
|
|
fontSize: token.statisticTitleFontSize,
|
|
},
|
|
[`${token.statisticCls}-content`]: {
|
|
color: token.colorTextHeading,
|
|
fontSize: token.statisticContentFontSize,
|
|
fontFamily: token.statisticFontFamily,
|
|
[`${token.statisticCls}-content-value`]: {
|
|
display: 'inline-block',
|
|
direction: 'ltr',
|
|
},
|
|
[`${token.statisticCls}-content-prefix, ${token.statisticCls}-content-suffix`]: {
|
|
display: 'inline-block',
|
|
},
|
|
[`${token.statisticCls}-content-prefix`]: {
|
|
marginInlineStart: 4, // FIXME: hard code
|
|
},
|
|
[`${token.statisticCls}-content-suffix`]: {
|
|
marginInlineEnd: 4, // FIXME: hard code
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
// ============================== Export ==============================
|
|
export default function useStyle(prefixCls: string): UseComponentStyleResult {
|
|
const [theme, token, hashId] = useToken();
|
|
|
|
const statisticToken: StatisticToken = {
|
|
...token,
|
|
statisticCls: `.${prefixCls}`,
|
|
statisticTitleFontSize: token.fontSize,
|
|
statisticContentFontSize: 24, // FIXME: hard code
|
|
statisticFontFamily: token.fontFamily,
|
|
};
|
|
|
|
return [
|
|
useStyleRegister({ theme, token, hashId, path: [prefixCls] }, () => [
|
|
genStatisticStyle(statisticToken),
|
|
]),
|
|
hashId,
|
|
];
|
|
}
|