Skip to content

Commit 366e90e

Browse files
Merge release/1.36.1 into main branch (#757)
* change width to max-width on Card (#756)
1 parent cad4615 commit 366e90e

File tree

5 files changed

+143
-19
lines changed

5 files changed

+143
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@user-interviews/ui-design-system",
3-
"version": "1.36.0",
3+
"version": "1.36.1",
44
"dependencies": {
55
"react-bootstrap": "^2.5.0",
66
"react-router-dom": "^5.2.0",

spec/__snapshots__/Storyshots.test.js.snap

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4336,15 +4336,15 @@ exports[`Storyshots Components/Card Default 1`] = `
43364336
}
43374337
>
43384338
<section
4339-
className="Card Card--lg"
4339+
className="Card"
43404340
>
43414341
<div
43424342
className="Card__header"
43434343
>
43444344
<h2
43454345
className="Card__title"
43464346
>
4347-
Large card with title
4347+
Default card title
43484348
</h2>
43494349
<span
43504350
className="Card__helper-text"
@@ -4355,7 +4355,7 @@ exports[`Storyshots Components/Card Default 1`] = `
43554355
<h3
43564356
className="Card__subtitle"
43574357
>
4358-
And a subtitle
4358+
Subtitle
43594359
</h3>
43604360
<div>
43614361
Use knobs to try out the different card sizes
@@ -4364,6 +4364,95 @@ exports[`Storyshots Components/Card Default 1`] = `
43644364
</div>
43654365
`;
43664366

4367+
exports[`Storyshots Components/Card Sizes 1`] = `
4368+
<div
4369+
style={
4370+
Object {
4371+
"padding": "1rem",
4372+
}
4373+
}
4374+
>
4375+
<section
4376+
className="Card Card--xs"
4377+
>
4378+
<div
4379+
className="Card__header"
4380+
>
4381+
<h2
4382+
className="Card__title"
4383+
>
4384+
xs
4385+
</h2>
4386+
</div>
4387+
<code>
4388+
CardSizes.EXTRA_SMALL
4389+
</code>
4390+
</section>
4391+
<section
4392+
className="Card Card--sm"
4393+
>
4394+
<div
4395+
className="Card__header"
4396+
>
4397+
<h2
4398+
className="Card__title"
4399+
>
4400+
sm
4401+
</h2>
4402+
</div>
4403+
<code>
4404+
CardSizes.SMALL
4405+
</code>
4406+
</section>
4407+
<section
4408+
className="Card Card--md"
4409+
>
4410+
<div
4411+
className="Card__header"
4412+
>
4413+
<h2
4414+
className="Card__title"
4415+
>
4416+
md
4417+
</h2>
4418+
</div>
4419+
<code>
4420+
CardSizes.MEDIUM
4421+
</code>
4422+
</section>
4423+
<section
4424+
className="Card Card--lg"
4425+
>
4426+
<div
4427+
className="Card__header"
4428+
>
4429+
<h2
4430+
className="Card__title"
4431+
>
4432+
lg
4433+
</h2>
4434+
</div>
4435+
<code>
4436+
CardSizes.LARGE
4437+
</code>
4438+
</section>
4439+
<section
4440+
className="Card"
4441+
>
4442+
<div
4443+
className="Card__header"
4444+
>
4445+
<h2
4446+
className="Card__title"
4447+
>
4448+
default
4449+
</h2>
4450+
</div>
4451+
When no size is given, the Card takes up the full width of its parent container.
4452+
</section>
4453+
</div>
4454+
`;
4455+
43674456
exports[`Storyshots Components/CardContainer Default 1`] = `
43684457
<div
43694458
style={

src/Card/Card.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ import Card from './Card';
1313
<Story id="components-card--default" />
1414
</Canvas>
1515

16-
### When to use
17-
- Reason 1
18-
- Reason 2
19-
20-
### When to not use
21-
- Reason 1
22-
- Reason 2
2316

2417
## Props
2518

@@ -29,10 +22,18 @@ import Card from './Card';
2922

3023
### Default
3124

25+
`Card` will take up the full width of its parent container by default.
26+
3227
<Canvas>
3328
<Story id="components-card--default" />
3429
</Canvas>
3530

31+
### Sizes
32+
33+
<Canvas>
34+
<Story id="components-card--sizes" />
35+
</Canvas>
36+
3637
## Formatting
3738

3839
### States

src/Card/Card.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
outline-color: $ux-green-500;
99
padding: $card-spacing;
1010

11-
width: 100%;
11+
max-width: 100%;
1212

1313
&__divider {
1414
border-top: 1px solid rgba(0,0,0,.1);

src/Card/Card.stories.jsx

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import {
3-
withKnobs, text, radios, boolean,
3+
withKnobs, text, select, boolean,
44
} from '@storybook/addon-knobs';
55

66
import Card, { CardSizes } from 'src/Card';
@@ -19,15 +19,49 @@ export default {
1919

2020
export const Default = () => (
2121
<Card
22-
divided={boolean('With divider', false)}
23-
helperText={text('Helper text', '(helper text)')}
24-
noPadding={boolean('Without padding', false)}
25-
size={radios('Message Type', CardSizes, CardSizes.LARGE)}
26-
subTitle={text('Subtitle', 'And a subtitle')}
27-
title={text('Title', 'Large card with title')}
22+
divided={boolean('divided', false)}
23+
helperText={text('helperText', '(helper text)')}
24+
noPadding={boolean('noPadding', false)}
25+
size={select('size', CardSizes, undefined)}
26+
subTitle={text('subTitle', 'Subtitle')}
27+
title={text('title', 'Default card title')}
2828
>
2929
<div>
3030
Use knobs to try out the different card sizes
3131
</div>
3232
</Card>
3333
);
34+
35+
export const Sizes = () => (
36+
<>
37+
<Card
38+
size={CardSizes.EXTRA_SMALL}
39+
title="xs"
40+
>
41+
<code>CardSizes.EXTRA_SMALL</code>
42+
</Card>
43+
<Card
44+
size={CardSizes.SMALL}
45+
title="sm"
46+
>
47+
<code>CardSizes.SMALL</code>
48+
</Card>
49+
<Card
50+
size={CardSizes.MEDIUM}
51+
title="md"
52+
>
53+
<code>CardSizes.MEDIUM</code>
54+
</Card>
55+
<Card
56+
size={CardSizes.LARGE}
57+
title="lg"
58+
>
59+
<code>CardSizes.LARGE</code>
60+
</Card>
61+
<Card
62+
title="default"
63+
>
64+
When no size is given, the Card takes up the full width of its parent container.
65+
</Card>
66+
</>
67+
);

0 commit comments

Comments
 (0)