Skip to content

Commit 3da2704

Browse files
Copilothectahertz
andauthored
Remove styled-components usage from TreeView.features.stories.tsx (#6506)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: hectahertz <[email protected]> Co-authored-by: Hector Garcia <[email protected]>
1 parent 3c31b39 commit 3da2704

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.StorybookDecorator {
2+
max-width: 400px;
3+
}
4+
5+
.ControlledContainer {
6+
display: grid;
7+
gap: var(--base-size-16);
8+
}
9+
10+
.ButtonContainer {
11+
display: flex;
12+
gap: var(--base-size-8);
13+
}
14+
15+
.ScrollContainer {
16+
max-height: 50vh;
17+
overflow: auto;
18+
}

packages/react/src/TreeView/TreeView.features.stories.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
} from '@primer/octicons-react'
99
import type {Meta, StoryFn} from '@storybook/react-vite'
1010
import React from 'react'
11-
import Box from '../Box'
1211
import {Button, IconButton} from '../Button'
1312
import Octicon from '../Octicon'
1413
import type {SubTreeState} from './TreeView'
1514
import {TreeView} from './TreeView'
15+
import classes from './TreeView.features.stories.module.css'
1616

1717
const meta: Meta = {
1818
title: 'Components/TreeView/Features',
@@ -21,9 +21,9 @@ const meta: Meta = {
2121
Story => {
2222
return (
2323
// Prevent TreeView from expanding to the full width of the screen
24-
<Box sx={{maxWidth: 400}}>
24+
<div className={classes.StorybookDecorator}>
2525
<Story />
26-
</Box>
26+
</div>
2727
)
2828
},
2929
],
@@ -275,11 +275,11 @@ export const Controlled: StoryFn = () => {
275275
const [tree, setTree] = React.useState<TreeItem[]>(initialTree)
276276

277277
return (
278-
<Box sx={{display: 'grid', gap: 3}}>
279-
<Box sx={{display: 'flex', gap: 2}}>
278+
<div className={classes.ControlledContainer}>
279+
<div className={classes.ButtonContainer}>
280280
<Button onClick={() => setTree(collapseAll)}>Collapse all</Button>
281281
<Button onClick={() => setTree(expandAll)}>Expand all</Button>
282-
</Box>
282+
</div>
283283
<nav aria-label="Files">
284284
<CurrentPathContext.Provider value={{currentPath, setCurrentPath}}>
285285
<TreeView aria-label="Files">
@@ -294,7 +294,7 @@ export const Controlled: StoryFn = () => {
294294
</TreeView>
295295
</CurrentPathContext.Provider>
296296
</nav>
297-
</Box>
297+
</div>
298298
)
299299
}
300300

@@ -700,7 +700,7 @@ export const NestedTrees: StoryFn = () => {
700700

701701
export const NestedScrollContainer: StoryFn = () => {
702702
return (
703-
<Box sx={{maxHeight: '50vh', overflow: 'auto'}}>
703+
<div className={classes.ScrollContainer}>
704704
<TreeView aria-label="Files">
705705
{Array.from({length: 100}).map((_, i) => (
706706
<TreeView.Item key={i} id={`directory-${i}`}>
@@ -726,7 +726,7 @@ export const NestedScrollContainer: StoryFn = () => {
726726
</TreeView.Item>
727727
))}
728728
</TreeView>
729-
</Box>
729+
</div>
730730
)
731731
}
732732

0 commit comments

Comments
 (0)