Skip to content

Commit

Permalink
refactor(Descriptions): delete itemStyle prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jandiasnow committed Apr 10, 2024
1 parent 9754f53 commit c1904b9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
3 changes: 0 additions & 3 deletions src/Descriptions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface CustomDescriptionsProps {
borderedBottomDashed?: boolean;
borderedTop?: boolean;
borderedTopDashed?: boolean;
itemStyle?: React.CSSProperties;
}
export interface DescriptionsProps extends AntdDescriptionsProps, CustomDescriptionsProps {}

Expand All @@ -24,15 +23,13 @@ export const Descriptions: React.FC<DescriptionsProps> & {
borderedBottomDashed,
borderedTop,
borderedTopDashed,
itemStyle,
...otherProps
} = props;
const { styles, cx } = useStyles({
borderedBottom,
borderedBottomDashed,
borderedTop,
borderedTopDashed,
itemStyle,
size: otherProps.size,
});
return <AntdDescriptions {...otherProps} className={cx(styles.custom, className)} />;
Expand Down
10 changes: 1 addition & 9 deletions src/Descriptions/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const useStyles = createStyles(
borderedBottomDashed,
borderedTop,
borderedTopDashed,
itemStyle,
size,
}: DescriptionsProps
) => {
Expand All @@ -20,21 +19,14 @@ export const useStyles = createStyles(
default: `${token.paddingSM}px ${token.paddingLG}px`,
};
const hasCustomSizeStyle = borderedBottom || borderedBottomDashed;
const itemStyleString =
itemStyle &&
Object.keys(itemStyle)
// @ts-ignore
.map(key => `${key}:${itemStyle[key]};`)
.join('');
return {
custom: css`
.${prefixCls}-descriptions-item-content {
align-items: center !important;
}
.${prefixCls}-descriptions-row > td {
padding-bottom: 8px !important;
padding-top: 8px !important;
${itemStyleString}
padding-bottom: 8px !important;
}
${hasCustomSizeStyle &&
size &&
Expand Down

0 comments on commit c1904b9

Please sign in to comment.