Skip to content

Commit

Permalink
feat(Card): add image prop to card component
Browse files Browse the repository at this point in the history
  • Loading branch information
athurman committed Aug 17, 2016
1 parent 6ca2406 commit bbecc1b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/views/Card/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -24,6 +25,7 @@ function Card(props) {
fluid,
header,
href,
image,
meta,
onClick,
raised,
Expand Down Expand Up @@ -51,6 +53,7 @@ function Card(props) {
href={href}
onClick={handleClick}
>
{createImage(image)}
{children || <CardContent description={description} header={header} meta={meta} />}
</CardComponent>
)
Expand All @@ -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,
Expand All @@ -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']),
Expand Down

0 comments on commit bbecc1b

Please sign in to comment.