Skip to content

Commit bf4a15c

Browse files
authored
Update ActionList.examples.stories.tsx to no longer use styled-components (#6544)
1 parent 1ea2dfb commit bf4a15c

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.AllCombinationsContainer {
2+
max-width: 300px;
3+
}
4+
5+
.AsyncListSearch {
6+
margin: var(--base-size-8);
7+
margin-bottom: 0;
8+
width: calc(100% - var(--base-size-16));
9+
}
10+
11+
.AsyncListNoMatch {
12+
display: block;
13+
font-size: var(--text-body-size-medium);
14+
margin: var(--base-size-8);
15+
}
16+
17+
.AsyncListItems {
18+
height: 208px;
19+
overflow: auto;
20+
}
21+
22+
.AsyncListSpinner {
23+
display: flex;
24+
justify-content: center;
25+
padding-top: var(--base-size-8);
26+
}

packages/react/src/ActionList/ActionList.examples.stories.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import {
1414
import {ActionList} from '.'
1515
import TextInput from '../TextInput'
1616
import Spinner from '../Spinner'
17-
import Box from '../Box'
1817
import Text from '../Text'
1918
import FormControl from '../FormControl'
2019
import {AriaStatus} from '../live-region'
2120
import {VisuallyHidden} from '../VisuallyHidden'
2221
import {ReactRouterLikeLink} from '../Pagination/mocks/ReactRouterLink'
22+
import classes from './ActionList.examples.stories.module.css'
2323

2424
const meta: Meta = {
2525
title: 'Components/ActionList/Examples',
@@ -209,23 +209,20 @@ export function AsyncListWithSpinner(): JSX.Element {
209209
filter. This pattern can be found in branch selection menus via the SelectPanel component.
210210
</p>
211211

212-
<FormControl sx={{m: 2, mb: 0, width: 'calc(100% - 16px)'}}>
212+
<FormControl className={classes.AsyncListSearch}>
213213
<FormControl.Label>Search branches</FormControl.Label>
214214
<TextInput onChange={filter} block />
215215
</FormControl>
216-
{results.length === 0 ? (
217-
<Text sx={{display: 'block', fontSize: 1, m: 2}}>No branches match that query</Text>
218-
) : null}
219-
216+
{results.length === 0 ? <Text className={classes.AsyncListNoMatch}>No branches match that query</Text> : null}
220217
<VisuallyHidden>
221218
<AriaStatus>{getStatusMessage()}</AriaStatus>
222219
</VisuallyHidden>
223220

224-
<ActionList selectionVariant="single" role="listbox" aria-label="Branch" sx={{height: 208, overflow: 'auto'}}>
221+
<ActionList selectionVariant="single" role="listbox" aria-label="Branch" className={classes.AsyncListItems}>
225222
{loading ? (
226-
<Box sx={{display: 'flex', justifyContent: 'center', pt: 2}}>
223+
<div className={classes.AsyncListSpinner}>
227224
<Spinner />
228-
</Box>
225+
</div>
229226
) : (
230227
results.map(name => (
231228
<ActionList.Item key={name} role="option" selected={selected === name} onSelect={() => setSelected(name)}>
@@ -249,7 +246,7 @@ export function AllCombinations(): JSX.Element {
249246
<code>16 possible combinations</code>
250247
<br />
251248
<br />
252-
<Box maxWidth="300px">
249+
<div className={classes.AllCombinationsContainer}>
253250
<ActionList showDividers>
254251
<ActionList.Item>
255252
<ActionList.LeadingVisual>
@@ -438,7 +435,7 @@ export function AllCombinations(): JSX.Element {
438435
</ActionList.TrailingVisual>
439436
</ActionList.Item>
440437
</ActionList>
441-
</Box>
438+
</div>
442439
</>
443440
)
444441
}

0 commit comments

Comments
 (0)