feat: completed all functions of the card component and wrote test sa…#87
Merged
Conversation
合并最新主分支代码
duenyang
reviewed
Jul 19, 2024
| export interface CardProps extends TdCardProps, StyledProps {} | ||
|
|
||
| @tag('t-card') | ||
| export default class Card extends Component<CardProps> { |
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, | ||
| }); |
| @@ -0,0 +1,10 @@ | |||
| // 临时col | |||
| @@ -0,0 +1,16 @@ | |||
| // 临时row | |||
| @@ -0,0 +1,10 @@ | |||
| // 临时tag | |||
Contributor
duenyang
reviewed
Jul 29, 2024
| avatar: Object, | ||
| bordered: Boolean, | ||
| content: Object, | ||
| cover: [Object, String], |
Contributor
There was a problem hiding this comment.
所有TNode类型需要设置[String,Number,Object,Function],其它地方同理
Comment on lines
+85
to
+88
| const titleClass = classname({ | ||
| [`${classPrefix}-card__title`]: title, | ||
| }); | ||
| const renderTitle = title ? <div className={titleClass}>{title}</div> : null; |
Contributor
There was a problem hiding this comment.
const renderTitle = title ? <div className={classname({
[`${classPrefix}-card__title`]: title,
})}>{title}</div> : null;
其它地方同理
duenyang
reviewed
Jul 30, 2024
Comment on lines
+89
to
+96
| <div | ||
| className={classname({ | ||
| [`${classPrefix}-card__title`]: title, | ||
| })} | ||
| > | ||
| {title} | ||
| </div> | ||
| ) : null; |
Contributor
There was a problem hiding this comment.
在这种场景下,title一定为true
直接写
title ? (
<div
className={`${classPrefix}-card__title`}
>
{title}
</div>
) : null;
duenyang
approved these changes
Jul 31, 2024
This was referenced Oct 17, 2024
Closed
This was referenced Dec 16, 2024
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

add card component