Skip to content

Commit

Permalink
feat(Card): add link prop (#1359)
Browse files Browse the repository at this point in the history
* feat(Card): add link prop

* docs(Card): add example for card link prop

* fix(CardExampleLinkCardProp): description prop
  • Loading branch information
BrainMaestro authored and levithomason committed Feb 21, 2017
1 parent e8f826c commit a93729c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/app/Examples/views/Card/Content/CardExampleLinkCardProp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import { Card } from 'semantic-ui-react'

const CardExampleLinkCardProp = () => (
<Card
link
header='Rick Sanchez'
meta='Scientist'
description={[
'Rick is a genius scientist whose alcoholism and reckless,',
' nihilistic behavior are a source of concern for his family',
].join('')}
/>
)

export default CardExampleLinkCardProp
3 changes: 3 additions & 0 deletions docs/app/Examples/views/Card/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const Content = () => (
description='A card can be formatted to link to other content.'
examplePath='views/Card/Content/CardExampleLinkCard'
/>
<ComponentExample
examplePath='views/Card/Content/CardExampleLinkCardProp'
/>
</ExampleSection>
)

Expand Down
5 changes: 5 additions & 0 deletions src/views/Card/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export default class Card extends Component {
/** A card can contain an Image component. */
image: customPropTypes.itemShorthand,

/** A card can be formatted to link to other content. */
link: PropTypes.bool,

/** Shorthand for CardMeta. */
meta: customPropTypes.itemShorthand,

Expand Down Expand Up @@ -100,6 +103,7 @@ export default class Card extends Component {
header,
href,
image,
link,
meta,
onClick,
raised,
Expand All @@ -110,6 +114,7 @@ export default class Card extends Component {
color,
useKeyOnly(centered, 'centered'),
useKeyOnly(fluid, 'fluid'),
useKeyOnly(link, 'link'),
useKeyOnly(raised, 'raised'),
'card',
className,
Expand Down
1 change: 1 addition & 0 deletions test/specs/views/Card/Card-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Card', () => {

common.propKeyOnlyToClassName(Card, 'centered')
common.propKeyOnlyToClassName(Card, 'fluid')
common.propKeyOnlyToClassName(Card, 'link')
common.propKeyOnlyToClassName(Card, 'raised')

common.propValueOnlyToClassName(Card, 'color', SUI.COLORS)
Expand Down

0 comments on commit a93729c

Please sign in to comment.