2024-04-08 14:04:08 +08:00
|
|
|
import { unit } from '@ant-design/cssinjs';
|
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-04-13 16:22:28 +08:00
|
|
|
|
2023-06-01 15:16:58 +08:00
|
|
|
import { clearFix, resetComponent, textEllipsis } from '../../style';
|
2023-11-13 16:39:00 +08:00
|
|
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
2023-11-29 17:23:45 +08:00
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
2022-04-13 16:22:28 +08:00
|
|
|
|
2023-06-01 15:16:58 +08:00
|
|
|
export interface ComponentToken {
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 卡片头部背景色
|
|
|
|
* @descEN Background color of card header
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
headerBg: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 卡片头部文字大小
|
|
|
|
* @descEN Font size of card header
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
headerFontSize: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 小号卡片头部文字大小
|
|
|
|
* @descEN Font size of small card header
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
headerFontSizeSM: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 卡片头部高度
|
|
|
|
* @descEN Height of card header
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
headerHeight: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 小号卡片头部高度
|
|
|
|
* @descEN Height of small card header
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
headerHeightSM: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 操作区背景色
|
|
|
|
* @descEN Background color of card actions
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
actionsBg: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 操作区每一项的外间距
|
|
|
|
* @descEN Margin of each item in card actions
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
actionsLiMargin: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 内置标签页组件下间距
|
|
|
|
* @descEN Margin bottom of tabs component
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
tabsMarginBottom: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 额外区文字颜色
|
|
|
|
* @descEN Text color of extra area
|
|
|
|
*/
|
2023-06-01 15:16:58 +08:00
|
|
|
extraColor: string;
|
|
|
|
}
|
2022-10-25 17:04:36 +08:00
|
|
|
|
2022-04-13 16:22:28 +08:00
|
|
|
interface CardToken extends FullToken<'Card'> {
|
2022-12-21 16:14:09 +08:00
|
|
|
cardShadow: string;
|
2022-04-13 16:22:28 +08:00
|
|
|
cardHeadPadding: number;
|
2022-10-25 17:04:36 +08:00
|
|
|
cardPaddingSM: number;
|
2022-04-13 16:22:28 +08:00
|
|
|
cardPaddingBase: number;
|
|
|
|
cardActionsIconSize: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================== Styles ==============================
|
|
|
|
|
|
|
|
// ============================== Head ==============================
|
|
|
|
const genCardHeadStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2023-06-01 15:16:58 +08:00
|
|
|
const { antCls, componentCls, headerHeight, cardPaddingBase, tabsMarginBottom } = token;
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
return {
|
2022-12-21 16:14:09 +08:00
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center',
|
|
|
|
flexDirection: 'column',
|
2023-06-01 15:16:58 +08:00
|
|
|
minHeight: headerHeight,
|
2022-04-13 16:22:28 +08:00
|
|
|
marginBottom: -1, // Fix card grid overflow bug: https://gw.alipayobjects.com/zos/rmsportal/XonYxBikwpgbqIQBeuhk.png
|
2023-11-13 16:39:00 +08:00
|
|
|
padding: `0 ${unit(cardPaddingBase)}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
color: token.colorTextHeading,
|
2022-05-13 16:38:33 +08:00
|
|
|
fontWeight: token.fontWeightStrong,
|
2023-06-01 15:16:58 +08:00
|
|
|
fontSize: token.headerFontSize,
|
|
|
|
background: token.headerBg,
|
2023-11-13 16:39:00 +08:00
|
|
|
borderBottom: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorderSecondary}`,
|
|
|
|
borderRadius: `${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)} 0 0`,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
...clearFix(),
|
|
|
|
|
|
|
|
'&-wrapper': {
|
2022-12-21 16:14:09 +08:00
|
|
|
width: '100%',
|
2022-04-13 16:22:28 +08:00
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-title': {
|
|
|
|
display: 'inline-block',
|
|
|
|
flex: 1,
|
2022-10-28 16:44:19 +08:00
|
|
|
...textEllipsis,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
2022-04-19 11:27:09 +08:00
|
|
|
[`
|
2022-04-13 16:22:28 +08:00
|
|
|
> ${componentCls}-typography,
|
|
|
|
> ${componentCls}-typography-edit-content
|
|
|
|
`]: {
|
2022-04-19 11:27:09 +08:00
|
|
|
insetInlineStart: 0,
|
2022-04-13 16:22:28 +08:00
|
|
|
marginTop: 0,
|
|
|
|
marginBottom: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-05-13 16:38:33 +08:00
|
|
|
[`${antCls}-tabs-top`]: {
|
2022-04-13 16:22:28 +08:00
|
|
|
clear: 'both',
|
2023-06-01 15:16:58 +08:00
|
|
|
marginBottom: tabsMarginBottom,
|
2022-04-13 16:22:28 +08:00
|
|
|
color: token.colorText,
|
|
|
|
fontWeight: 'normal',
|
2022-11-01 15:06:38 +08:00
|
|
|
fontSize: token.fontSize,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
'&-bar': {
|
2023-11-13 16:39:00 +08:00
|
|
|
borderBottom: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorderSecondary}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Grid ==============================
|
|
|
|
const genCardGridStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2022-05-13 16:38:33 +08:00
|
|
|
const { cardPaddingBase, colorBorderSecondary, cardShadow, lineWidth } = token;
|
2022-04-13 16:22:28 +08:00
|
|
|
return {
|
2022-05-13 16:38:33 +08:00
|
|
|
width: '33.33%',
|
2022-04-13 16:22:28 +08:00
|
|
|
padding: cardPaddingBase,
|
|
|
|
border: 0,
|
|
|
|
borderRadius: 0,
|
|
|
|
boxShadow: `
|
2023-11-13 16:39:00 +08:00
|
|
|
${unit(lineWidth)} 0 0 0 ${colorBorderSecondary},
|
|
|
|
0 ${unit(lineWidth)} 0 0 ${colorBorderSecondary},
|
|
|
|
${unit(lineWidth)} ${unit(lineWidth)} 0 0 ${colorBorderSecondary},
|
|
|
|
${unit(lineWidth)} 0 0 0 ${colorBorderSecondary} inset,
|
|
|
|
0 ${unit(lineWidth)} 0 0 ${colorBorderSecondary} inset;
|
2022-05-13 16:38:33 +08:00
|
|
|
`,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${token.motionDurationMid}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
'&-hoverable:hover': {
|
|
|
|
position: 'relative',
|
|
|
|
zIndex: 1,
|
|
|
|
boxShadow: cardShadow,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Actions ==============================
|
|
|
|
const genCardActionsStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2023-06-01 15:16:58 +08:00
|
|
|
const {
|
|
|
|
componentCls,
|
|
|
|
iconCls,
|
|
|
|
actionsLiMargin,
|
|
|
|
cardActionsIconSize,
|
|
|
|
colorBorderSecondary,
|
|
|
|
actionsBg,
|
|
|
|
} = token;
|
2022-04-13 16:22:28 +08:00
|
|
|
return {
|
|
|
|
margin: 0,
|
|
|
|
padding: 0,
|
|
|
|
listStyle: 'none',
|
2023-06-01 15:16:58 +08:00
|
|
|
background: actionsBg,
|
2023-11-13 16:39:00 +08:00
|
|
|
borderTop: `${unit(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
|
2022-04-27 21:43:16 +08:00
|
|
|
display: 'flex',
|
2023-11-13 16:39:00 +08:00
|
|
|
borderRadius: `0 0 ${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
...clearFix(),
|
|
|
|
|
|
|
|
'& > li': {
|
2023-06-01 15:16:58 +08:00
|
|
|
margin: actionsLiMargin,
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-04-13 16:22:28 +08:00
|
|
|
textAlign: 'center',
|
|
|
|
|
|
|
|
'> span': {
|
|
|
|
position: 'relative',
|
|
|
|
display: 'block',
|
2023-11-13 16:39:00 +08:00
|
|
|
minWidth: token.calc(token.cardActionsIconSize).mul(2).equal(),
|
2022-05-13 16:38:33 +08:00
|
|
|
fontSize: token.fontSize,
|
2022-04-13 16:22:28 +08:00
|
|
|
lineHeight: token.lineHeight,
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
color: token.colorPrimary,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `color ${token.motionDurationMid}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`a:not(${componentCls}-btn), > ${iconCls}`]: {
|
|
|
|
display: 'inline-block',
|
|
|
|
width: '100%',
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2023-11-13 16:39:00 +08:00
|
|
|
lineHeight: unit(token.fontHeight),
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `color ${token.motionDurationMid}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
color: token.colorPrimary,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`> ${iconCls}`]: {
|
|
|
|
fontSize: cardActionsIconSize,
|
2023-11-13 16:39:00 +08:00
|
|
|
lineHeight: unit(token.calc(cardActionsIconSize).mul(token.lineHeight).equal()),
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:not(:last-child)': {
|
2023-11-13 16:39:00 +08:00
|
|
|
borderInlineEnd: `${unit(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Meta ==============================
|
|
|
|
const genCardMetaStyle: GenerateStyle<CardToken> = (token): CSSObject => ({
|
2023-11-13 16:39:00 +08:00
|
|
|
margin: `${unit(token.calc(token.marginXXS).mul(-1).equal())} 0`,
|
2022-04-27 21:43:16 +08:00
|
|
|
display: 'flex',
|
2022-04-13 16:22:28 +08:00
|
|
|
...clearFix(),
|
|
|
|
|
|
|
|
'&-avatar': {
|
2022-05-13 16:38:33 +08:00
|
|
|
paddingInlineEnd: token.padding,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-detail': {
|
|
|
|
overflow: 'hidden',
|
2022-11-27 22:14:21 +08:00
|
|
|
flex: 1,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
'> div:not(:last-child)': {
|
|
|
|
marginBottom: token.marginXS,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-title': {
|
|
|
|
color: token.colorTextHeading,
|
2022-05-13 16:38:33 +08:00
|
|
|
fontWeight: token.fontWeightStrong,
|
2022-04-13 16:22:28 +08:00
|
|
|
fontSize: token.fontSizeLG,
|
2022-10-28 16:44:19 +08:00
|
|
|
...textEllipsis,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-description': {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// ============================== Inner ==============================
|
|
|
|
const genCardTypeInnerStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2022-12-21 16:14:09 +08:00
|
|
|
const { componentCls, cardPaddingBase, colorFillAlter } = token;
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-head`]: {
|
2023-11-13 16:39:00 +08:00
|
|
|
padding: `0 ${unit(cardPaddingBase)}`,
|
2022-07-21 17:00:42 +08:00
|
|
|
background: colorFillAlter,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
'&-title': {
|
2022-11-01 15:06:38 +08:00
|
|
|
fontSize: token.fontSize,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-body`]: {
|
2023-11-13 16:39:00 +08:00
|
|
|
padding: `${unit(token.padding)} ${unit(cardPaddingBase)}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Loading ==============================
|
2022-04-21 02:06:22 +08:00
|
|
|
const genCardLoadingStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2022-05-13 14:42:49 +08:00
|
|
|
const { componentCls } = token;
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
|
|
|
[`${componentCls}-body`]: {
|
|
|
|
userSelect: 'none',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Basic ==============================
|
2022-04-21 02:06:22 +08:00
|
|
|
const genCardStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2022-04-13 16:22:28 +08:00
|
|
|
const {
|
2023-05-26 16:14:33 +08:00
|
|
|
antCls,
|
2022-04-13 16:22:28 +08:00
|
|
|
componentCls,
|
|
|
|
cardShadow,
|
|
|
|
cardHeadPadding,
|
2022-05-13 16:38:33 +08:00
|
|
|
colorBorderSecondary,
|
2023-02-03 11:20:21 +08:00
|
|
|
boxShadowTertiary,
|
2022-10-25 17:04:36 +08:00
|
|
|
cardPaddingBase,
|
2023-06-01 15:16:58 +08:00
|
|
|
extraColor,
|
2022-04-13 16:22:28 +08:00
|
|
|
} = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[componentCls]: {
|
|
|
|
...resetComponent(token),
|
|
|
|
|
|
|
|
position: 'relative',
|
2022-06-28 20:33:01 +08:00
|
|
|
background: token.colorBgContainer,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadiusLG,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
2022-08-26 16:05:16 +08:00
|
|
|
[`&:not(${componentCls}-bordered)`]: {
|
2023-02-03 11:20:21 +08:00
|
|
|
boxShadow: boxShadowTertiary,
|
2022-08-26 16:05:16 +08:00
|
|
|
},
|
|
|
|
|
2022-04-13 16:22:28 +08:00
|
|
|
[`${componentCls}-head`]: genCardHeadStyle(token),
|
|
|
|
|
|
|
|
[`${componentCls}-extra`]: {
|
|
|
|
// https://stackoverflow.com/a/22429853/3040605
|
|
|
|
marginInlineStart: 'auto',
|
2023-06-01 15:16:58 +08:00
|
|
|
color: extraColor,
|
2022-04-13 16:22:28 +08:00
|
|
|
fontWeight: 'normal',
|
2022-11-01 15:06:38 +08:00
|
|
|
fontSize: token.fontSize,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-body`]: {
|
|
|
|
padding: cardPaddingBase,
|
2024-04-16 11:42:45 +08:00
|
|
|
borderRadius: `0 0 ${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
...clearFix(),
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-grid`]: genCardGridStyle(token),
|
|
|
|
|
|
|
|
[`${componentCls}-cover`]: {
|
|
|
|
'> *': {
|
|
|
|
display: 'block',
|
|
|
|
width: '100%',
|
|
|
|
},
|
|
|
|
|
2023-05-26 16:14:33 +08:00
|
|
|
[`img, img + ${antCls}-image-mask`]: {
|
2023-11-13 16:39:00 +08:00
|
|
|
borderRadius: `${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)} 0 0`,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-actions`]: genCardActionsStyle(token),
|
|
|
|
|
|
|
|
[`${componentCls}-meta`]: genCardMetaStyle(token),
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-bordered`]: {
|
2023-11-13 16:39:00 +08:00
|
|
|
border: `${unit(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
[`${componentCls}-cover`]: {
|
|
|
|
marginTop: -1,
|
|
|
|
marginInlineStart: -1,
|
|
|
|
marginInlineEnd: -1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-hoverable`]: {
|
|
|
|
cursor: 'pointer',
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `box-shadow ${token.motionDurationMid}, border-color ${token.motionDurationMid}`,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
'&:hover': {
|
2022-05-13 16:38:33 +08:00
|
|
|
borderColor: 'transparent',
|
2022-04-13 16:22:28 +08:00
|
|
|
boxShadow: cardShadow,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-27 21:43:16 +08:00
|
|
|
[`${componentCls}-contain-grid`]: {
|
2023-11-13 16:39:00 +08:00
|
|
|
borderRadius: `${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)} 0 0 `,
|
2022-04-27 21:43:16 +08:00
|
|
|
[`${componentCls}-body`]: {
|
|
|
|
display: 'flex',
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:not(${componentCls}-loading) ${componentCls}-body`]: {
|
2023-11-13 16:39:00 +08:00
|
|
|
marginBlockStart: token.calc(token.lineWidth).mul(-1).equal(),
|
|
|
|
marginInlineStart: token.calc(token.lineWidth).mul(-1).equal(),
|
2022-04-27 21:43:16 +08:00
|
|
|
padding: 0,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-contain-tabs`]: {
|
|
|
|
[`> ${componentCls}-head`]: {
|
2023-10-11 15:43:59 +08:00
|
|
|
minHeight: 0,
|
2022-12-21 16:14:09 +08:00
|
|
|
[`${componentCls}-head-title, ${componentCls}-extra`]: {
|
|
|
|
paddingTop: cardHeadPadding,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-type-inner`]: genCardTypeInnerStyle(token),
|
|
|
|
|
2022-04-21 02:06:22 +08:00
|
|
|
[`${componentCls}-loading`]: genCardLoadingStyle(token),
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
[`${componentCls}-rtl`]: {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Size ==============================
|
|
|
|
const genCardSizeStyle: GenerateStyle<CardToken> = (token): CSSObject => {
|
2023-06-01 15:16:58 +08:00
|
|
|
const { componentCls, cardPaddingSM, headerHeightSM, headerFontSizeSM } = token;
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-small`]: {
|
|
|
|
[`> ${componentCls}-head`]: {
|
2023-06-01 15:16:58 +08:00
|
|
|
minHeight: headerHeightSM,
|
2023-11-13 16:39:00 +08:00
|
|
|
padding: `0 ${unit(cardPaddingSM)}`,
|
2023-06-01 15:16:58 +08:00
|
|
|
fontSize: headerFontSizeSM,
|
2022-04-13 16:22:28 +08:00
|
|
|
|
|
|
|
[`> ${componentCls}-head-wrapper`]: {
|
|
|
|
[`> ${componentCls}-extra`]: {
|
2022-05-13 16:38:33 +08:00
|
|
|
fontSize: token.fontSize,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`> ${componentCls}-body`]: {
|
2022-10-25 17:04:36 +08:00
|
|
|
padding: cardPaddingSM,
|
2022-04-13 16:22:28 +08:00
|
|
|
},
|
|
|
|
},
|
2022-12-21 16:14:09 +08:00
|
|
|
[`${componentCls}-small${componentCls}-contain-tabs`]: {
|
|
|
|
[`> ${componentCls}-head`]: {
|
|
|
|
[`${componentCls}-head-title, ${componentCls}-extra`]: {
|
|
|
|
paddingTop: 0,
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-04-13 16:22:28 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-11-13 16:39:00 +08:00
|
|
|
export const prepareComponentToken: GetDefaultToken<'Card'> = (token) => ({
|
|
|
|
headerBg: 'transparent',
|
|
|
|
headerFontSize: token.fontSizeLG,
|
|
|
|
headerFontSizeSM: token.fontSize,
|
|
|
|
headerHeight: token.fontSizeLG * token.lineHeightLG + token.padding * 2,
|
|
|
|
headerHeightSM: token.fontSize * token.lineHeight + token.paddingXS * 2,
|
|
|
|
actionsBg: token.colorBgContainer,
|
|
|
|
actionsLiMargin: `${token.paddingSM}px 0`,
|
|
|
|
tabsMarginBottom: -token.padding - token.lineWidth,
|
|
|
|
extraColor: token.colorText,
|
|
|
|
});
|
|
|
|
|
2022-04-13 16:22:28 +08:00
|
|
|
// ============================== Export ==============================
|
2023-11-29 17:23:45 +08:00
|
|
|
export default genStyleHooks(
|
2023-06-01 15:16:58 +08:00
|
|
|
'Card',
|
|
|
|
(token) => {
|
|
|
|
const cardToken = mergeToken<CardToken>(token, {
|
|
|
|
cardShadow: token.boxShadowCard,
|
|
|
|
cardHeadPadding: token.padding,
|
|
|
|
cardPaddingBase: token.paddingLG,
|
|
|
|
cardActionsIconSize: token.fontSize,
|
|
|
|
cardPaddingSM: 12, // Fixed padding.
|
|
|
|
});
|
|
|
|
|
|
|
|
return [
|
|
|
|
// Style
|
|
|
|
genCardStyle(cardToken),
|
|
|
|
|
|
|
|
// Size
|
|
|
|
genCardSizeStyle(cardToken),
|
|
|
|
];
|
|
|
|
},
|
2023-11-13 16:39:00 +08:00
|
|
|
prepareComponentToken,
|
2023-06-01 15:16:58 +08:00
|
|
|
);
|