Skip to content

Commit

Permalink
refactor(roundedCard): remove unnecessary code and controls and add a…
Browse files Browse the repository at this point in the history
…ll variations
  • Loading branch information
tarantilis committed Jul 13, 2022
1 parent ca06948 commit 6305c54
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ui/Card/AvatarGrid/AvatarGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AvatarGrid.Group = ({ children, ...rest }) => {
className={`eea rounded ${
rest.variant === 'default' ? '' : rest.variant
} ${rest.inverted ? 'inverted' : ''}`}
fluid={avatar.fluid}
fluid={rest.fluid}
>
{rest.hasLink ? (
<Image
Expand Down
10 changes: 10 additions & 0 deletions src/ui/Card/AvatarGrid/AvatarGrid.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export default {
type: { summary: 'boolean' },
},
},
fluid: {
description: 'take up the width of its container',
table: {
type: {
summary: 'boolean',
},
defaultValue: { summary: false },
},
},
hasLink: {
description: 'Clickable card',
table: {
Expand Down Expand Up @@ -57,6 +66,7 @@ export const RoundedGrid = GridTemplate.bind({});
RoundedGrid.args = {
variant: 'default',
inverted: false,
fluid: false,
hasLink: true,
href: '/#',
avatars: [
Expand Down
27 changes: 26 additions & 1 deletion src/ui/Card/RoundedCard.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ export default {
},
},
argTypes: {
variant: {
options: ['default', 'primary', 'secondary', 'tertiary'],
control: { type: 'select' },
description: 'card variation class',
table: {
type: {
summary: 'string',
},
defaultValue: { summary: 'null' },
},
},
inverted: {
description: 'Inverted card',
table: {
defaultValue: { summary: 'false' },
type: { summary: 'boolean' },
},
},
hasImage: {
description: 'true if card contains image',
table: {
Expand Down Expand Up @@ -61,7 +79,12 @@ export default {

const AvatarTemplate = (args) => (
<Container>
<Card className="rounded" fluid={args.fluid}>
<Card
className={`rounded ${args.variant === 'default' ? '' : args.variant} ${
args.inverted ? 'inverted' : ''
}`}
fluid={args.fluid}
>
{args.hasImage && (
<Image src={args.src} wrapped ui={false} alt="card image" />
)}
Expand All @@ -75,6 +98,8 @@ const AvatarTemplate = (args) => (

export const Default = AvatarTemplate.bind({});
Default.args = {
variant: 'default',
inverted: false,
src: imgUrl,
title: 'Lorem Ipsum',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
Expand Down
3 changes: 1 addition & 2 deletions theme/themes/eea/views/card.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@

.ui.card.rounded {
padding-top: @iconCardPaddingTop;
width: @roundedWidth;
border: none;

.image {
Expand All @@ -246,7 +245,7 @@
img {
width: @roundedImageWidth;
height: @roundedImageHeight;
border-radius: 50%;
border-radius: @roundedImageBorderRadius;
}
}

Expand Down
8 changes: 0 additions & 8 deletions theme/themes/eea/views/card.variables
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,10 @@
Rounded Card
*******************************/
/* Global */
@roundedWidth : 100%;
@roundedWrapperWidth : 100%;
@roundedWrapperGap : @largeGap;
@roundedContentWrapperWidth : 100%;
@roundedImageBorderRadius : @circularRadius;
@roundedContentTitleMarginBottom : @rem-space-2;
@roundedImageWrapperWidth : 100%;
@roundedImageBackgroundSize : cover;
@roundedContentTitleFontWeight : @bold;
@roundedContentTitleFontSize : @font-size-3;

/* Big */
@roundedImageHeight : 173px;
@roundedImageWidth : 173px;
@roundedMetadataFontSize : @font-size-1;
Expand Down

0 comments on commit 6305c54

Please sign in to comment.