Skip to content

Commit f504cba

Browse files
Make sure storybook defaults match component defaults
1 parent f539ae1 commit f504cba

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

src/lib/Card/Card.scss

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
flex-direction: column;
66
background: $color__n-85;
77
border-radius: $border-radius__m;
8+
width: 100%;
89

910
&--transparent {
1011
background: transparent;
@@ -19,12 +20,29 @@
1920
align-self: flex-end;
2021
}
2122
}
23+
24+
&--compact {
25+
.card__main {
26+
flex-wrap: wrap;
27+
}
28+
29+
.card__body {
30+
width: 100%;
31+
order: 3;
32+
margin-top: $spacing__s;
33+
margin-left: 0;
34+
}
35+
36+
.card__cta {
37+
order: 2;
38+
}
39+
}
2240

2341
&__main {
2442
display: flex;
2543
flex-direction: row;
2644
align-items: flex-start;
27-
justify-content: space-evenly;
45+
justify-content: space-between;
2846
padding: $spacing__m;
2947
}
3048

@@ -38,6 +56,7 @@
3856
align-items: center;
3957
object-fit: cover;
4058
aspect-ratio: 1/1;
59+
order: 1;
4160

4261
img {
4362
height: 100%;
@@ -84,7 +103,12 @@
84103
font-size: 1.125rem;
85104
display: flex;
86105
flex-direction: column;
87-
margin: 0 $spacing__m
106+
margin: 0 $spacing__m;
107+
order: 2;
108+
}
109+
110+
&__cta {
111+
order: 3;
88112
}
89113

90114
&__footer {

src/lib/Card/Card.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ SampleComponent.parameters = {
2929
};
3030

3131
SampleComponent.args = {
32-
children: <div style={{ width: "300px" }}>Team lead</div>,
32+
children: <div>Team lead</div>,
3333
title: "MangoBurger",
34-
imageSize: CardImageSize.LARGE,
34+
imageSize: CardImageSize.MEDIUM,
3535
image: <img src="/images/default-avatar.png" />,
36-
imageBorderRadius: CardImageBorderRadius.MEDIUM,
36+
imageBorderRadius: CardImageBorderRadius.CIRCLE,
3737
cta: { text: "Follow", onClick: () => console.log("follow") },
3838
variants: [
3939
CardVariant.TRANSPARENT,

src/lib/Card/Card.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const Card: React.FC<CardProps> = ({
4040
{/* CTA */}
4141
{cta && (
4242
<Button
43+
className="card__cta"
4344
onClick={cta.onClick}
4445
label={cta.text}
4546
variant={ButtonVariant.SECONDARY}

src/lib/Card/Card.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface CardProps extends React.PropsWithChildren {
3535
/** An array of links to be rendered in the footer of the card. */
3636
footerLinks?: ReactElement<HTMLAnchorElement>[];
3737
/** The size of the image displayed in the top left corner. Defaults to medium */
38-
imageSize: CardImageSize;
38+
imageSize?: CardImageSize;
3939
/** The image to be displayed in the top left corner */
4040
image: ReactElement<HTMLImageElement>;
4141
/** Border radius of the image. Defaults to circle */

0 commit comments

Comments
 (0)