> = React.memo(({
[type, theme.palette, shadow],
)
+ const [withoutFooterChildren, footerChildren] = pickChild(children, CardFooter)
+ const [withoutImageChildren, imageChildren] = pickChild(withoutFooterChildren, Image)
+
+
return (
- {children}
+ {imageChildren}
+
+ {withoutImageChildren}
+
+ {footerChildren}
+
)
})
-export default withDefaults(Card, defaultProps)
+type CardComponent = React.FC
& {
+ Footer: typeof CardFooter
+ Actions: typeof CardFooter
+}
+
+type ComponentProps = Partial & Omit & NativeAttrs
+
+(Card as CardComponent).defaultProps = defaultProps
+
+export default Card as CardComponent
diff --git a/components/card/index.ts b/components/card/index.ts
index 28f6097..3c4a890 100644
--- a/components/card/index.ts
+++ b/components/card/index.ts
@@ -1,3 +1,7 @@
import Card from './card'
+import CardFooter from './card-footer'
+
+Card.Footer = CardFooter
+Card.Actions = CardFooter
export default Card
diff --git a/pages/en-us/components/card.mdx b/pages/en-us/components/card.mdx
index 49e06ab..fbc4c2e 100644
--- a/pages/en-us/components/card.mdx
+++ b/pages/en-us/components/card.mdx
@@ -1,5 +1,5 @@
import { Layout, Playground, Attributes } from 'lib/components'
-import { Card, Spacer, Row, Col } from 'components'
+import { Card, Spacer, Row, Col, Link, Image, Text } from 'components'
export const meta = {
title: 'card',
@@ -10,7 +10,6 @@ export const meta = {
A common container component.
-
+
+
+ ZEIT UI React
+ Modern and minimalist React UI library.
+
+ Visit source code on GitHub.
+
+
+
+ ZEIT UI React
+ Modern and minimalist React UI library.
+
+ Visit source code on GitHub.
+
+
+
+`} />
+
+
+
+ ZEIT UI React
+ Modern and minimalist React UI library.
+
+ Visit source code on GitHub.
+
+
+`} />
+
Card.Props
@@ -78,7 +114,15 @@ A common container component.
| **hoverable** | add effect on hover | `boolean` | - | `false` |
| **shadow** | show shadow | `boolean` | - | `false` |
| **type** | card type | [CardType](#cardtype) | - | `default` |
-| ... | native props | `HTMLAttributes` | `'className', ...` | - |
+| **width** | CSS width value | `string` | - | `100%` |
+| ... | native props | `HTMLAttributes` | `'id', className', ...` | - |
+
+Card.Footer.Props
+
+| Attribute | Description | Type | Accepted values | Default
+| ---------- | ---------- | ---- | -------------- | ------ |
+| **disableAutoMargin** | cancel automatic margin value | `boolean` | - | `false` |
+| ... | native props | `HTMLAttributes` | `'id', className', ...` | - |
CardType
diff --git a/pages/zh-cn/components/card.mdx b/pages/zh-cn/components/card.mdx
index 0c0a25f..cb84365 100644
--- a/pages/zh-cn/components/card.mdx
+++ b/pages/zh-cn/components/card.mdx
@@ -1,5 +1,5 @@
import { Layout, Playground, Attributes } from 'lib/components'
-import { Card, Row, Col } from 'components'
+import { Card, Row, Col, Link, Spacer, Text, Image } from 'components'
export const meta = {
title: '卡片 Card',
@@ -72,6 +72,44 @@ export const meta = {
}
`} />
+
+
+
+ ZEIT UI React
+ 现代化、极简风格的 UI 库。
+
+ 在 GitHub 上查看源码
+
+
+
+ ZEIT UI React
+ 现代化、极简风格的 UI 库。
+
+ 在 GitHub 上查看源码
+
+
+
+`} />
+
+
+
+ ZEIT UI React
+ 现代化、极简风格的 UI 库。
+
+ 在 GitHub 上查看源码
+
+
+`} />
+
Card.Props
@@ -80,7 +118,15 @@ export const meta = {
| **hoverable** | 是否在悬停时增加阴影 | `boolean` | - | `false` |
| **shadow** | 是否总是显示阴影 | `boolean` | - | `false` |
| **type** | 卡片的类型 | [CardType](#cardtype) | - | `default` |
-| ... | 原生属性 | `HTMLAttributes` | `'className', ...` | - |
+| **width** | CSS 宽度属性 | `string` | - | `100%` |
+| ... | 原生属性 | `HTMLAttributes` | `'id', className', ...` | - |
+
+Card.Footer.Props
+
+| 属性 | 描述 | 类型 | 推荐值 | 默认
+| ---------- | ---------- | ---- | -------------- | ------ |
+| **disableAutoMargin** | 取消自动设置的 Margin 值 | `boolean` | - | `false` |
+| ... | 原生属性 | `HTMLAttributes` | `'id', className', ...` | - |
CardType