mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
8e27cf986f
* chore: rm component less file * refactor: less file * refactor: rm less * refactor: rm page-header and comment * chore: rm less in components * chore: update dist config * chore: update image test * chore: update dekko * chore: rm lib dekko * chore: update dist dekko * chore: udpate bundle size * test: update snapshot * test: rm theme test * test: update snapshot * test: update snapshot * chore: copy reset.css * test: update image test * chore: copy reset.css to es * chore: update site script
81 lines
2.2 KiB
TypeScript
81 lines
2.2 KiB
TypeScript
import type { CSSObject } from '@ant-design/cssinjs';
|
||
import type { FullToken, GenerateStyle } from '../../theme';
|
||
import { genComponentStyleHook, mergeToken } from '../../theme';
|
||
|
||
/** Component only token. Which will handle additional calculation of alias token */
|
||
export interface ComponentToken {}
|
||
|
||
interface EmptyToken extends FullToken<'Empty'> {
|
||
emptyImgCls: string;
|
||
emptyImgHeight: number;
|
||
emptyImgHeightSM: number;
|
||
emptyImgHeightMD: number;
|
||
}
|
||
|
||
// ============================== Shared ==============================
|
||
const genSharedEmptyStyle: GenerateStyle<EmptyToken> = (token): CSSObject => {
|
||
const { componentCls, margin, marginXS, marginXL, fontSizeBase, lineHeight } = token;
|
||
|
||
return {
|
||
[componentCls]: {
|
||
marginInline: marginXS,
|
||
fontSize: fontSizeBase,
|
||
lineHeight,
|
||
textAlign: 'center',
|
||
|
||
// 原来 &-image 没有父子结构,现在为了外层承担我们的hashId,改成父子结果
|
||
[`${componentCls}-image`]: {
|
||
height: token.emptyImgHeight,
|
||
marginBottom: marginXS,
|
||
opacity: token.opacityImage,
|
||
|
||
img: {
|
||
height: '100%',
|
||
},
|
||
|
||
svg: {
|
||
height: '100%',
|
||
margin: 'auto',
|
||
},
|
||
},
|
||
|
||
// 原来 &-footer 没有父子结构,现在为了外层承担我们的hashId,改成父子结果
|
||
[`${componentCls}-footer`]: {
|
||
marginTop: margin,
|
||
},
|
||
|
||
'&-normal': {
|
||
marginBlock: marginXL,
|
||
color: token.colorTextDisabled,
|
||
|
||
[`${componentCls}-image`]: {
|
||
height: token.emptyImgHeightMD,
|
||
},
|
||
},
|
||
|
||
'&-small': {
|
||
marginBlock: marginXS,
|
||
color: token.colorTextDisabled,
|
||
|
||
[`${componentCls}-image`]: {
|
||
height: token.emptyImgHeightSM,
|
||
},
|
||
},
|
||
},
|
||
};
|
||
};
|
||
|
||
// ============================== Export ==============================
|
||
export default genComponentStyleHook('Empty', token => {
|
||
const { componentCls, controlHeightLG } = token;
|
||
|
||
const emptyToken: EmptyToken = mergeToken<EmptyToken>(token, {
|
||
emptyImgCls: `${componentCls}-img`,
|
||
emptyImgHeight: controlHeightLG * 2.5,
|
||
emptyImgHeightMD: controlHeightLG,
|
||
emptyImgHeightSM: controlHeightLG * 0.875,
|
||
});
|
||
|
||
return [genSharedEmptyStyle(emptyToken)];
|
||
});
|