Skip to content

Commit f80a156

Browse files
committed
docs: updates stories with stack and inline
1 parent bb391ed commit f80a156

File tree

20 files changed

+220
-171
lines changed

20 files changed

+220
-171
lines changed

src/components/AspectRatio/AspectRatio.stories.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import React, { ComponentProps, useState } from 'react'
33
import { AspectRatio } from '.'
44
import { Box } from '../Box'
55
import { Card, CardBody, CardHeading, CardSubheading } from '../Card'
6-
import { Row } from '../Flex'
76
import { Image } from '../Image'
7+
import { Inline } from '../Inline'
88
import { Label } from '../Label'
99
import { Slider } from '../Slider'
10+
import { Stack } from '../Stack'
1011

1112
export default {
1213
title: 'Components/AspectRatio',
@@ -40,12 +41,18 @@ export const Dynamic: Story = () => {
4041
const [denominator, setDenominator] = useState([16])
4142

4243
return (
43-
<Row>
44+
<Inline>
4445
<Box variant="wide">
45-
<Label>Numerator</Label>
46-
<Slider value={numerator} onValueChange={setNumerator} />
47-
<Label>Denominator</Label>
48-
<Slider value={denominator} onValueChange={setDenominator} />
46+
<Stack>
47+
<Label>
48+
Numerator
49+
<Slider value={numerator} onValueChange={setNumerator} />
50+
</Label>
51+
<Label>
52+
Denominator
53+
<Slider value={denominator} onValueChange={setDenominator} />
54+
</Label>
55+
</Stack>
4956
</Box>
5057
<Card css={{ width: '50%' }}>
5158
<CardHeading>Photo by Damian Markutt</CardHeading>
@@ -59,6 +66,6 @@ export const Dynamic: Story = () => {
5966
</AspectRatio>
6067
</CardBody>
6168
</Card>
62-
</Row>
69+
</Inline>
6370
)
6471
}

src/components/Button/Button.stories.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Meta, Story } from '@storybook/react'
22
import React, { ComponentProps } from 'react'
3-
import { Column, Grid, Row } from '../'
3+
import { Grid } from '../'
44
import { Variants } from '../../docs/util'
5+
import { Inline } from '../Inline'
6+
import { Stack } from '../Stack'
57
import { Button } from './Button'
68

79
export default {
@@ -61,16 +63,16 @@ export const Default: Story<ComponentProps<typeof Button>> = (args) => {
6163

6264
/* Three size options are available */
6365
export const Size: Story = () => (
64-
<Row css={{ gap: '$3', mb: '$3' }}>
66+
<Inline>
6567
<Button size="small">Small</Button>
6668
<Button size="default">Default</Button>
6769
<Button size="large">Large</Button>
68-
</Row>
70+
</Inline>
6971
)
7072

7173
/* Add `full-width` to make the button grow to take the full width */
7274
export const FullWidth: Story = () => (
73-
<Column css={{ gap: '$3' }}>
75+
<Stack>
7476
<Button full-width size="small">
7577
Small
7678
</Button>
@@ -80,7 +82,7 @@ export const FullWidth: Story = () => (
8082
<Button full-width size="large">
8183
Large
8284
</Button>
83-
</Column>
85+
</Stack>
8486
)
8587

8688
/* Three variants are supported,
@@ -90,16 +92,16 @@ export const FullWidth: Story = () => (
9092
* - `tertiary` use to pair with others as cancel or for icon buttons
9193
*/
9294
export const Variant: Story = () => (
93-
<Row css={{ gap: '$3' }}>
95+
<Inline>
9496
<Button variant="primary">Primary</Button>
9597
<Button variant="secondary">Secondary</Button>
9698
<Button variant="tertiary">Tertiary</Button>
97-
</Row>
99+
</Inline>
98100
)
99101

100102
/** If the action is destructive, say a delete or an action that cannot be undone, add the `destructive` flag */
101103
export const Destructive: Story = () => (
102-
<Row css={{ gap: '$3' }}>
104+
<Inline>
103105
<Button destructive variant="primary">
104106
Primary
105107
</Button>
@@ -109,12 +111,12 @@ export const Destructive: Story = () => (
109111
<Button destructive variant="tertiary">
110112
Tertiary
111113
</Button>
112-
</Row>
114+
</Inline>
113115
)
114116

115117
/** The `disabled` state is controlled in the standard way */
116118
export const Disabled: Story = () => (
117-
<Row css={{ gap: '$3' }}>
119+
<Inline>
118120
<Button disabled variant="primary">
119121
Primary
120122
</Button>
@@ -124,7 +126,7 @@ export const Disabled: Story = () => (
124126
<Button disabled variant="tertiary">
125127
Tertiary
126128
</Button>
127-
</Row>
129+
</Inline>
128130
)
129131

130132
/**

src/components/Card/Card.stories.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
CardLeadIn,
1111
CardSubheading,
1212
} from '.'
13-
import { Button, IconButton, Row, Svg, Text } from '../'
13+
import { Button, IconButton, Svg, Text } from '../'
14+
import { Inline } from '../Inline'
1415

1516
export default {
1617
title: 'Components/Card',
@@ -44,7 +45,7 @@ export const Default: Story = () => {
4445
*/
4546
export const Classic: Story = () => {
4647
return (
47-
<Row css={{ gap: '$3' }}>
48+
<Inline>
4849
<Card>
4950
<CardHeading>Default Card</CardHeading>
5051
<CardBody>
@@ -57,7 +58,7 @@ export const Classic: Story = () => {
5758
<Text>Lorem Ipsum is simply dummy text...</Text>
5859
</CardBody>
5960
</Card>
60-
</Row>
61+
</Inline>
6162
)
6263
}
6364

@@ -68,7 +69,7 @@ export const Classic: Story = () => {
6869
*/
6970
export const Outline: Story = () => {
7071
return (
71-
<Row css={{ gap: '$3' }}>
72+
<Inline>
7273
<Card variant="outline">
7374
<CardHeading>Outline</CardHeading>
7475
<CardBody>
@@ -81,7 +82,7 @@ export const Outline: Story = () => {
8182
<Text>Lorem Ipsum is simply dummy text...</Text>
8283
</CardBody>
8384
</Card>
84-
</Row>
85+
</Inline>
8586
)
8687
}
8788

@@ -92,7 +93,7 @@ export const Outline: Story = () => {
9293
*/
9394
export const Ghost: Story = () => {
9495
return (
95-
<Row css={{ gap: '$3' }}>
96+
<Inline>
9697
<Card variant="ghost">
9798
<CardHeading>Ghost</CardHeading>
9899
<CardBody>
@@ -105,7 +106,7 @@ export const Ghost: Story = () => {
105106
<Text>Lorem Ipsum is simply dummy text...</Text>
106107
</CardBody>
107108
</Card>
108-
</Row>
109+
</Inline>
109110
)
110111
}
111112

@@ -128,7 +129,7 @@ export const Body: Story = () => (
128129
* By default headings are just `div`s, use the `as` prop if the heading should be semantic.
129130
*/
130131
export const Headers: Story = () => (
131-
<Row css={{ flexWrap: 'wrap', gap: '$3' }}>
132+
<Inline wrap>
132133
<Card>
133134
<CardHeading>Heading</CardHeading>
134135
<CardBody>
@@ -149,7 +150,7 @@ export const Headers: Story = () => (
149150
<Text>Lorem Ipsum is simply dummy text...</Text>
150151
</CardBody>
151152
</Card>
152-
</Row>
153+
</Inline>
153154
)
154155

155156
/**
@@ -159,7 +160,7 @@ export const Headers: Story = () => (
159160
* If a more complex layout is required you can create your own.
160161
*/
161162
export const Actions: Story = () => (
162-
<Row css={{ flexWrap: 'wrap', gap: '$3' }}>
163+
<Inline wrap>
163164
<Card>
164165
<CardHeading>
165166
Heading
@@ -228,5 +229,5 @@ export const Actions: Story = () => (
228229
/>
229230
</CardActions>
230231
</Card>
231-
</Row>
232+
</Inline>
232233
)

src/components/Chip/Chip.stories.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { action } from '@storybook/addon-actions'
22
import { Meta, Story } from '@storybook/react'
33
import React from 'react'
44
import { Chip } from '.'
5-
import { Row } from '../'
65
import { Variants } from '../../docs/util'
6+
import { Inline } from '../Inline'
77

88
export default {
99
title: 'Components/Chip',
@@ -14,17 +14,17 @@ export const Default: Story = (args) => <Chip {...args}>Chip</Chip>
1414

1515
/** Chips are available in 2 sizes, `default` and `small` */
1616
export const Sizes: Story = () => (
17-
<>
17+
<Inline css={{ alignItems: 'center' }}>
1818
<Chip variant="info" size="small">
1919
New
2020
</Chip>
2121
<Chip variant="error">Error</Chip>
22-
</>
22+
</Inline>
2323
)
2424

2525
/** If an `onClose` prop is provided a close button is added and clicking calls the onClose` */
2626
export const Closable: Story = () => (
27-
<Row css={{ gap: '$3', alignItems: 'center' }}>
27+
<Inline css={{ alignItems: 'center' }}>
2828
<Chip variant="info" size="small" onClose={action('close')}>
2929
Close
3030
</Chip>
@@ -50,7 +50,7 @@ export const Closable: Story = () => (
5050
>
5151
Click
5252
</Chip>
53-
</Row>
53+
</Inline>
5454
)
5555

5656
export const All: Story = () => (
@@ -95,7 +95,7 @@ export const Interactive: Story = () => (
9595
)
9696

9797
export const Disabled: Story = () => (
98-
<Row css={{ gap: '$3', alignItems: 'center' }}>
98+
<Inline css={{ alignItems: 'center' }}>
9999
<Chip
100100
as="button"
101101
onClick={action('disabled')}
@@ -128,5 +128,5 @@ export const Disabled: Story = () => (
128128
>
129129
Disabled
130130
</Chip>
131-
</Row>
131+
</Inline>
132132
)

src/components/Dialog/Dialog.stories.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import {
1010
DialogTitle,
1111
DialogTrigger,
1212
} from '.'
13-
import { Box, Button, Column, IconButton, Link, Row, Text } from '../'
13+
import { Box, Button, IconButton, Link, Row, Text } from '../'
1414
import { Close as CloseIcon } from '../Icons'
15+
import { Inline } from '../Inline'
16+
import { Stack } from '../Stack'
1517

1618
export default {
1719
title: 'Components/Dialog',
@@ -97,15 +99,15 @@ export const CloseButton: Story = () => {
9799

98100
/**
99101
* The dialog is portalled by default. This means the dialog will be appended to the body and so over lay other elements.
100-
* In addition, the `CompontsProvider`, by default, isolates the children in their own stacking context so this will not be afected by the z-index of other elements of the UI.
102+
* In addition, the `ComponentsProvider`, by default, isolates the children in their own stacking context so this will not be affected by the z-index of other elements of the UI.
101103
*
102104
* This example shows how the z-index of other elements in the UI do not affect the dialog.
103105
*
104106
* This may not be the desired behaviour for your application so these defaults can be overridden, see below.
105107
*/
106108
export const Portalled: Story = () => {
107109
return (
108-
<Row gap centered>
110+
<Inline align="center">
109111
<Dialog>
110112
<DialogTrigger>
111113
<Button>Default</Button>
@@ -162,7 +164,7 @@ export const Portalled: Story = () => {
162164
</DialogContent>
163165
</Dialog>
164166
</Box>
165-
</Row>
167+
</Inline>
166168
)
167169
}
168170

@@ -171,7 +173,7 @@ export const Portalled: Story = () => {
171173
*/
172174
export const zIndex: Story = () => {
173175
return (
174-
<Row gap centered>
176+
<Inline align="center">
175177
<Dialog>
176178
<DialogTrigger>
177179
<Button>Default</Button>
@@ -235,19 +237,19 @@ export const zIndex: Story = () => {
235237
</DialogContent>
236238
</Dialog>
237239
</Box>
238-
</Row>
240+
</Inline>
239241
)
240242
}
241243

242244
/**
243-
* The element the dialog portalls to can be provided, and different effects can be achieved by supplying additional css. For example:
245+
* The element the dialog portals to can be provided, and different effects can be achieved by supplying additional css. For example:
244246
*/
245247
export const Container: Story = () => {
246248
const [element, setElement] = useState<HTMLElement | null>(null)
247249

248250
return (
249-
<Column gap>
250-
<Row gap centered>
251+
<Stack align="center">
252+
<Inline align="center">
251253
<Dialog>
252254
<DialogTrigger>
253255
<Button>Default</Button>
@@ -334,14 +336,14 @@ export const Container: Story = () => {
334336
</DialogContent>
335337
</Dialog>
336338
</Box>
337-
</Row>
339+
</Inline>
338340
<Row
339341
css={{ position: 'relative', minHeight: '200px', minWidth: '100%' }}
340342
centered
341343
ref={setElement}
342344
>
343345
<Text>This area will now contain the dialog</Text>
344346
</Row>
345-
</Column>
347+
</Stack>
346348
)
347349
}

0 commit comments

Comments
 (0)