From e966d1fce6699a31df6e603987be45e18cc13df1 Mon Sep 17 00:00:00 2001 From: Amanda Thurman Date: Tue, 16 Aug 2016 17:57:20 -0500 Subject: [PATCH] feat(Card): add image prop to card component --- src/views/Card/Card.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/views/Card/Card.js b/src/views/Card/Card.js index ccd2d35721..67a68c8365 100644 --- a/src/views/Card/Card.js +++ b/src/views/Card/Card.js @@ -8,6 +8,7 @@ import { SUI, useKeyOnly, } from '../../lib' +import { createImage } from '../../factories' import CardContent from './CardContent' import CardDescription from './CardDescription' import CardGroup from './CardGroup' @@ -24,6 +25,7 @@ function Card(props) { fluid, header, href, + image, meta, onClick, raised, @@ -51,6 +53,7 @@ function Card(props) { href={href} onClick={handleClick} > + {createImage(image)} {children || } ) @@ -69,7 +72,10 @@ Card.propTypes = { centered: PropTypes.bool, /** Primary content of the Card. */ - children: PropTypes.node, + children: customPropTypes.every([ + customPropTypes.disallow(['description', 'header', 'image', 'meta']), + PropTypes.node, + ]), /** Classes that will be added to the Card className. */ className: PropTypes.string, @@ -95,6 +101,12 @@ Card.propTypes = { /** Render as an `a` tag instead of a `div` and adds the href attribute. */ href: PropTypes.string, + /** An card can contain image. */ + image: customPropTypes.every([ + customPropTypes.disallow(['children']), + PropTypes.node, + ]), + /** Shorthand prop for CardMeta. Mutually exclusive with children. */ meta: customPropTypes.every([ customPropTypes.disallow(['children']),