Skip to content

Commit 4f4a8af

Browse files
authored
Update SegmentedControl.features.stories.tsx to no longer use styled-components (#6477)
1 parent e23e5cf commit 4f4a8af

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.LabelAndCaptionContainer {
2+
display: flex;
3+
flex-direction: column;
4+
gap: var(--base-size-4);
5+
}
6+
7+
@media screen and (min-width: 768px) {
8+
.LabelAndCaptionContainer {
9+
flex-direction: row;
10+
}
11+
}
12+
13+
.LabelAndCaption {
14+
flex-grow: 1;
15+
}

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {useState} from 'react'
22
import type {Meta} from '@storybook/react-vite'
33
import {SegmentedControl} from '.'
44
import {EyeIcon, FileCodeIcon, PeopleIcon} from '@primer/octicons-react'
5-
import {Box, Text} from '..'
5+
import {Text} from '..'
6+
import classes from './SegmentedControl.features.stories.module.css'
67

78
export default {
89
title: 'Components/SegmentedControl/Features',
@@ -122,29 +123,20 @@ export const IconOnly = () => (
122123
IconOnly.storyName = 'Icon only'
123124

124125
export const AssociatedWithALabelAndCaption = () => (
125-
<Box
126-
display="flex"
127-
sx={theme => ({
128-
flexDirection: 'column',
129-
gap: theme.space[1],
130-
[`@media screen and (min-width: ${theme.breakpoints[1]})`]: {
131-
flexDirection: 'row',
132-
},
133-
})}
134-
>
135-
<Box flexGrow={1}>
126+
<div className={classes.LabelAndCaptionContainer}>
127+
<div className={classes.LabelAndCaption}>
136128
<Text fontSize={2} fontWeight="bold" id="scLabel-vert" display="block">
137129
File view
138130
</Text>
139131
<Text color="fg.subtle" fontSize={1} id="scCaption-vert" display="block">
140132
Change the way the file is viewed
141133
</Text>
142-
</Box>
134+
</div>
143135
<SegmentedControl aria-labelledby="scLabel-vert" aria-describedby="scCaption-vert">
144136
<SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>
145137
<SegmentedControl.Button>Raw</SegmentedControl.Button>
146138
<SegmentedControl.Button>Blame</SegmentedControl.Button>
147139
</SegmentedControl>
148-
</Box>
140+
</div>
149141
)
150142
AssociatedWithALabelAndCaption.storyName = '[Example] Associated with a label and caption'

0 commit comments

Comments
 (0)