Skip to content

Commit

Permalink
feat(card): add boxShadow prop (#1754)
Browse files Browse the repository at this point in the history
Co-authored-by: maxin <maxin@growingio.com>
  • Loading branch information
nnmax and maxin committed Dec 31, 2021
1 parent 760f763 commit 9843887
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const Card = WithRef<HTMLDivElement, CardProps>(
children,
className,
prefixCls: customizePrefixCls,
boxShadow = false,
...restProps
}: CardProps,
ref?
Expand All @@ -22,6 +23,7 @@ export const Card = WithRef<HTMLDivElement, CardProps>(
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-clickable`]: clickable,
[`${prefixCls}-full-width-content`]: fullWidthContent,
[`${prefixCls}-box-shadow`]: boxShadow,
});

return (
Expand Down
10 changes: 9 additions & 1 deletion src/card/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ export interface CardMetaProps extends Omit<React.HTMLAttributes<HTMLDivElement>

export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
/**
* 是否宽度平铺
* 是否宽度平铺(没有 padding)
* @default false
*/
fullWidthContent?: boolean;
/**
* 不可选
* @default false
*/
disabled?: boolean;
/**
Expand All @@ -38,10 +40,16 @@ export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
/**
* 卡片是否可点击
* @default true
*/
clickable?: boolean;
/**
* 自定义className前缀
*/
prefixCls?: string;
/**
* 是否显示阴影 ( box-shadow: 0px 3px 8px rgba(36, 46, 89, 0.05); )
* @default false
*/
boxShadow?: boolean;
}
3 changes: 3 additions & 0 deletions src/card/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
&-disabled .@{card-meta-prefix-cls}-description {
color: @gray-3;
}
&-box-shadow {
.elevation(1);
}
}

.@{card-meta-prefix-cls} {
Expand Down

1 comment on commit 9843887

@vercel
Copy link

@vercel vercel bot commented on 9843887 Dec 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.