Skip to content

Commit 58a5253

Browse files
authored
Merge pull request #1111 from oceanbase/feat/use-new-collapsible-icon-for-pro-card
improve(ui): [pro-card] use new collapsible icon
1 parent b900216 commit 58a5253

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/ui/src/ProCard/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { ProCard as AntProCard } from '@ant-design/pro-components';
33
import type { ProCardProps } from '@ant-design/pro-components';
44
import { ConfigProvider } from '@oceanbase/design';
55
import { isHorizontalPaddingZero } from '@oceanbase/design/es/_util';
6+
import { theme } from '@oceanbase/design';
67
import classNames from 'classnames';
78
import useStyle from './style';
9+
import { CaretRightFilled } from '@oceanbase/icons';
810

911
export { ProCardProps };
1012

@@ -19,10 +21,11 @@ const ProCard: typeof AntProCard = ({
1921
className,
2022
...restProps
2123
}) => {
22-
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
24+
const { getPrefixCls, iconPrefixCls } = useContext(ConfigProvider.ConfigContext);
2325

2426
const prefixCls = getPrefixCls('pro-card', customizePrefixCls);
2527
const { wrapSSR } = useStyle(prefixCls);
28+
const { token } = theme.useToken();
2629

2730
// ProCard body no horizontal padding
2831
const noBodyHorizontalPadding = isHorizontalPaddingZero(bodyStyle?.padding) || ghost;
@@ -53,6 +56,18 @@ const ProCard: typeof AntProCard = ({
5356
headerBordered={headerBordered}
5457
bodyStyle={bodyStyle}
5558
className={proCardCls}
59+
collapsibleIconRender={({ collapsed }) => {
60+
return (
61+
<CaretRightFilled
62+
className={`${iconPrefixCls} ${iconPrefixCls}-right ${prefixCls}-collapsible-icon`}
63+
style={{
64+
transition: 'transform 0.2s',
65+
transform: collapsed ? undefined : 'rotate(90deg)',
66+
color: token.colorTextSecondary,
67+
}}
68+
/>
69+
);
70+
}}
5671
{...restProps}
5772
/>
5873
);

0 commit comments

Comments
 (0)