Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card 组件在仅传入 extra 时样式异常 #39643

Closed
suiyun39 opened this issue Dec 19, 2022 · 4 comments · Fixed by #39646
Closed

Card 组件在仅传入 extra 时样式异常 #39643

suiyun39 opened this issue Dec 19, 2022 · 4 comments · Fixed by #39646

Comments

@suiyun39
Copy link

Reproduction link

Edit on CodeSandbox

Steps to reproduce

打开链接, 无需操作

What is expected?

卡片头部应该有一定的高度或边距

What is actually happening?

extra 插入的元素上下贴边

Environment Info
antd 5.0.7
React 18
System Windows 11
Browser Microsoft Edge 108.0.1462.46
@JarvisArt
Copy link
Contributor

试了下padding是需要title撑起
image

@JarvisArt
Copy link
Contributor

对比了下v4中的extra也会有padding,v5是忘了加上样式还是设计如此?

@suiyun39
Copy link
Author

@JarvisArt

这是 V5 的样式:
image

这是 V4 的样式:
image

简单的读了下 Card 的 style, 声明处存在两个 height token:

interface CardToken extends FullToken<'Card'> {
cardHeaderHeight: number;
cardHeaderHeightSM: number;
cardShadow: string;
cardHeadHeight: number;
cardHeadPadding: number;
cardPaddingSM: number;
cardPaddingBase: number;
cardHeadTabsMarginBottom: number;
cardInnerHeadPadding: number;
cardActionsLiMargin: string;
cardActionsIconSize: number;
}

在使用时使用的是 cardHeadHeight:

return {
minHeight: cardHeadHeight,
marginBottom: -1, // Fix card grid overflow bug: https://gw.alipayobjects.com/zos/rmsportal/XonYxBikwpgbqIQBeuhk.png

但是有值的 token 应该是 cardHeaderHeight:

const cardToken = mergeToken<CardToken>(token, {
cardShadow: token.boxShadowCard,
cardHeaderHeight: token.fontSizeLG * token.lineHeightLG + token.padding * 2,
cardHeaderHeightSM: token.fontSize * token.lineHeight + token.paddingXS * 2,
cardHeadPadding: token.padding,

@suiyun39
Copy link
Author

追溯了一下, 两个 height token 声明分别来自 @MadCcc@miracles1919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants