Skip to content

feat: completed all functions of the card component and wrote test sa…#87

Merged
duenyang merged 9 commits into
TDesignOteam:mainfrom
zyy-bupt2022:feat/card
Jul 31, 2024
Merged

feat: completed all functions of the card component and wrote test sa…#87
duenyang merged 9 commits into
TDesignOteam:mainfrom
zyy-bupt2022:feat/card

Conversation

@zyy-bupt2022
Copy link
Copy Markdown
Contributor

@zyy-bupt2022 zyy-bupt2022 marked this pull request as draft July 12, 2024 09:35
@zyy-bupt2022 zyy-bupt2022 marked this pull request as ready for review July 12, 2024 09:36
合并最新主分支代码
Comment thread src/card/card.tsx
export interface CardProps extends TdCardProps, StyledProps {}

@tag('t-card')
export default class Card extends Component<CardProps> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

缺少 propTypes,参考其他组件

Comment thread src/card/card.tsx Outdated
Comment on lines +74 to +109
const headerClass = classname({
[`${classPrefix}-card__header`]: showHeader,
[`${classPrefix}-card__title--bordered`]: headerBordered,
});

const titleClass = classname({
[`${classPrefix}-card__title`]: title,
});

const subtitleClass = classname({
[`${classPrefix}-card__subtitle`]: subtitle,
});

const actionClass = classname({
[`${classPrefix}-card__actions`]: actions,
});

const footerClass = classname({
[`${classPrefix}-card__footer`]: footer,
});

const coverClass = classname({
[`${classPrefix}-card__cover`]: cover,
});

const avatarClass = classname({
[`${classPrefix}-card__avatar`]: avatar,
});

const bodyClass = classname({
[`${classPrefix}-card__body`]: children,
});

const descriptionClass = classname({
[`${classPrefix}-card__description`]: description,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

所有的class,放在对应的dom处定义

Comment thread src/col/index.tsx Outdated
@@ -0,0 +1,10 @@
// 临时col
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

使用 grid 组件

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

删除此目录

Comment thread src/row/index.tsx Outdated
@@ -0,0 +1,16 @@
// 临时row
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

删除此目录,使用grid组件

Comment thread src/tag/index.tsx Outdated
@@ -0,0 +1,10 @@
// 临时tag
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tag组件已经有了,是不是没合最新代码?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 25, 2024

完成

Comment thread src/card/card.tsx Outdated
avatar: Object,
bordered: Boolean,
content: Object,
cover: [Object, String],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

所有TNode类型需要设置[String,Number,Object,Function],其它地方同理

Comment thread src/card/card.tsx Outdated
Comment on lines +85 to +88
const titleClass = classname({
[`${classPrefix}-card__title`]: title,
});
const renderTitle = title ? <div className={titleClass}>{title}</div> : null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const renderTitle = title ? <div className={classname({
      [`${classPrefix}-card__title`]: title,
    })}>{title}</div> : null;

其它地方同理

Comment thread src/card/card.tsx Outdated
Comment on lines +89 to +96
<div
className={classname({
[`${classPrefix}-card__title`]: title,
})}
>
{title}
</div>
) : null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

在这种场景下,title一定为true
直接写

title ? (
      <div
        className={`${classPrefix}-card__title`}
      >
        {title}
      </div>
    ) : null;

@duenyang duenyang merged commit 44928b4 into TDesignOteam:main Jul 31, 2024
This was referenced Oct 17, 2024
This was referenced Dec 16, 2024
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 this pull request may close these issues.

2 participants