-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: completed all functions of the card component and wrote test sa… #87
Conversation
合并最新主分支代码
export interface CardProps extends TdCardProps, StyledProps {} | ||
|
||
@tag('t-card') | ||
export default class Card extends Component<CardProps> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少 propTypes,参考其他组件
src/card/card.tsx
Outdated
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, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有的class,放在对应的dom处定义
src/col/index.tsx
Outdated
@@ -0,0 +1,10 @@ | |||
// 临时col |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 grid 组件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删除此目录
src/row/index.tsx
Outdated
@@ -0,0 +1,16 @@ | |||
// 临时row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删除此目录,使用grid组件
src/tag/index.tsx
Outdated
@@ -0,0 +1,10 @@ | |||
// 临时tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag组件已经有了,是不是没合最新代码?
src/card/card.tsx
Outdated
avatar: Object, | ||
bordered: Boolean, | ||
content: Object, | ||
cover: [Object, String], |
There was a problem hiding this comment.
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],其它地方同理
src/card/card.tsx
Outdated
const titleClass = classname({ | ||
[`${classPrefix}-card__title`]: title, | ||
}); | ||
const renderTitle = title ? <div className={titleClass}>{title}</div> : null; |
There was a problem hiding this comment.
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;
其它地方同理
src/card/card.tsx
Outdated
<div | ||
className={classname({ | ||
[`${classPrefix}-card__title`]: title, | ||
})} | ||
> | ||
{title} | ||
</div> | ||
) : null; |
There was a problem hiding this comment.
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;
add card component