Skip to content

Commit

Permalink
refactor(roundedCard): add optional link for image and header
Browse files Browse the repository at this point in the history
  • Loading branch information
tarantilis committed Jul 18, 2022
1 parent fe84e46 commit a6d3bf2
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/ui/Card/RoundedCard.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ export default {
type: { summary: 'boolean' },
},
},
hasImage: {
description: 'true if card contains image',
table: {
type: {
summary: 'boolean',
},
defaultValue: { summary: true },
},
},
title: {
description: 'card header',
table: {
Expand Down Expand Up @@ -74,6 +65,13 @@ export default {
defaultValue: { summary: ' "" ' },
},
},
hasLink: {
description: 'Clickable card',
table: {
defaultValue: { summary: 'true' },
type: { summary: 'boolean' },
},
},
},
};

Expand All @@ -85,11 +83,26 @@ const AvatarTemplate = (args) => (
}`}
fluid={args.fluid}
>
{args.hasImage && (
{args.hasLink ? (
<Image
as="a"
href={args.href}
src={args.src}
wrapped
ui={false}
alt="card image"
/>
) : (
<Image src={args.src} wrapped ui={false} alt="card image" />
)}
<Card.Content>
<Card.Header>{args.title}</Card.Header>
{args.hasLink ? (
<Card.Header>
<a href={args.href}>{args.title}</a>
</Card.Header>
) : (
<Card.Header>{args.title}</Card.Header>
)}
<Card.Description>{args.description}</Card.Description>
</Card.Content>
</Card>
Expand All @@ -103,6 +116,7 @@ Default.args = {
src: imgUrl,
title: 'Lorem Ipsum',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
hasImage: true,
fluid: false,
hasLink: true,
href: '/#',
};

0 comments on commit a6d3bf2

Please sign in to comment.