Skip to content

Commit

Permalink
refactor: 根据cr修改代码
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy-bupt2022 committed Jul 30, 2024
1 parent 15a2545 commit c7fc731
Showing 1 changed file with 27 additions and 32 deletions.
59 changes: 27 additions & 32 deletions src/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,39 +109,34 @@ export default class Card extends Component<CardProps> {
</div>
);

const renderHeader = () => {
if (header) {
return (
<div
className={classname({
[`${classPrefix}-card__header`]: showHeader,
[`${classPrefix}-card__title--bordered`]: headerBordered,
})}
>
{header}
</div>
);
}
return (
<div
className={classname({
[`${classPrefix}-card__header`]: showHeader,
[`${classPrefix}-card__title--bordered`]: headerBordered,
})}
>
<div className={`${classPrefix}-card__header-wrapper`}>
{renderAvatar}
<div>
{renderTitle}
{renderSubtitle}
{renderDescription}
</div>
const renderHeader = header ? (
<div
className={classname({
[`${classPrefix}-card__header`]: showHeader,
[`${classPrefix}-card__title--bordered`]: headerBordered,
})}
>
{header}
</div>
) : (
<div
className={classname({
[`${classPrefix}-card__header`]: showHeader,
[`${classPrefix}-card__title--bordered`]: headerBordered,
})}
>
<div className={`${classPrefix}-card__header-wrapper`}>
{renderAvatar}
<div>
{renderTitle}
{renderSubtitle}
{renderDescription}
</div>
{renderHeaderActions}
{renderStatus}
</div>
);
};
{renderHeaderActions}
{renderStatus}
</div>
);

const renderCover = cover ? (
<div className={`${classPrefix}-card__cover`}>
Expand Down Expand Up @@ -171,7 +166,7 @@ export default class Card extends Component<CardProps> {
})}
style={style}
>
{showHeader ? renderHeader() : null}
{showHeader ? renderHeader : null}
{renderCover}
{renderChildren}
{renderFooter}
Expand Down

0 comments on commit c7fc731

Please sign in to comment.