11import React from 'react'
22import ToggleSwitch from './ToggleSwitch'
3- import { Box , Text } from '..'
43import { action } from 'storybook/actions'
54import ToggleSwitchStoryWrapper from './ToggleSwitchStoryWrapper'
5+ import { clsx } from 'clsx'
6+ import styles from './ToggleSwitch.features.stories.module.css'
67
78export default {
89 title : 'Components/ToggleSwitch/Features' ,
910}
1011
1112export const Small = ( ) => (
1213 < ToggleSwitchStoryWrapper >
13- < Text id = "toggle" fontWeight = { 'bold' } fontSize = { 1 } >
14+ < span id = "toggle" className = { styles . ToggleLabel } >
1415 Toggle label
15- </ Text >
16+ </ span >
1617 < ToggleSwitch size = "small" aria-labelledby = "toggle" />
1718 </ ToggleSwitchStoryWrapper >
1819)
1920
2021export const WithCaption = ( ) => (
21- < Box display = "flex" alignItems = { 'start' } >
22- < Box flexGrow = { 1 } >
23- < Text fontSize = { 2 } fontWeight = "bold" id = "switchLabel" display = "block ">
22+ < div className = { styles . Row } >
23+ < div className = { styles . ColGrow } >
24+ < span className = { styles . SwitchLabel } id = "switchLabel" >
2425 Notifications
25- </ Text >
26- < Text color = "fg.subtle" fontSize = { 1 } id = "switchCaption" display = "block ">
26+ </ span >
27+ < span className = { styles . SwitchCaption } id = "switchCaption" >
2728 Notifications will be delivered via email and the GitHub notification center
28- </ Text >
29- </ Box >
29+ </ span >
30+ </ div >
3031 < ToggleSwitch aria-labelledby = "switchLabel" aria-describedby = "switchCaption" />
31- </ Box >
32+ </ div >
3233)
3334
3435export const Disabled = ( ) => (
3536 < ToggleSwitchStoryWrapper >
36- < Text id = "toggle" fontWeight = { 'bold' } fontSize = { 1 } >
37+ < span id = "toggle" className = { styles . ToggleLabel } >
3738 Toggle label
38- </ Text >
39+ </ span >
3940 < ToggleSwitch disabled aria-labelledby = "toggle" />
4041 </ ToggleSwitchStoryWrapper >
4142)
4243
4344export const Checked = ( ) => (
4445 < ToggleSwitchStoryWrapper >
45- < Text id = "toggle" fontWeight = { 'bold' } fontSize = { 1 } >
46+ < span id = "toggle" className = { styles . ToggleLabel } >
4647 Toggle label
47- </ Text >
48+ </ span >
4849 < ToggleSwitch checked aria-labelledby = "toggle" />
4950 </ ToggleSwitchStoryWrapper >
5051)
5152
5253export const CheckedDisabled = ( ) => (
5354 < ToggleSwitchStoryWrapper >
54- < Text id = "toggle" fontWeight = { 'bold' } fontSize = { 1 } >
55+ < span id = "toggle" className = { styles . ToggleLabel } >
5556 Toggle label
56- </ Text >
57+ </ span >
5758 < ToggleSwitch checked disabled aria-labelledby = "toggle" />
5859 </ ToggleSwitchStoryWrapper >
5960)
6061
6162export const Loading = ( ) => (
6263 < ToggleSwitchStoryWrapper >
63- < Text id = "toggle" fontWeight = { 'bold' } fontSize = { 1 } >
64+ < span id = "toggle" className = { styles . ToggleLabel } >
6465 Toggle label
65- </ Text >
66+ </ span >
6667 < ToggleSwitch loading aria-labelledby = "toggle" />
6768 </ ToggleSwitchStoryWrapper >
6869)
6970
7071export const LabelEnd = ( ) => (
7172 < ToggleSwitchStoryWrapper >
72- < Text id = "toggle" fontWeight = { 'bold' } fontSize = { 1 } >
73+ < span id = "toggle" className = { styles . ToggleLabel } >
7374 Toggle label
74- </ Text >
75+ </ span >
7576 < ToggleSwitch statusLabelPosition = "end" aria-labelledby = "toggle" />
7677 </ ToggleSwitchStoryWrapper >
7778)
@@ -89,12 +90,12 @@ export const Controlled = () => {
8990
9091 return (
9192 < >
92- < Box display = "flex" maxWidth = " 300px" >
93- < Box flexGrow = { 1 } fontSize = { 2 } fontWeight = "bold" id = "switchLabel" >
93+ < div className = { styles . Row } style = { { maxWidth : ' 300px' } } >
94+ < span className = { clsx ( styles . ColGrow , styles . SwitchLabel ) } id = "switchLabel" >
9495 Notifications
95- </ Box >
96+ </ span >
9697 < ToggleSwitch onClick = { onClick } onChange = { handleSwitchChange } checked = { isOn } aria-labelledby = "switchLabel" />
97- </ Box >
98+ </ div >
9899 < p > The switch is { isOn ? 'on' : 'off' } </ p >
99100 </ >
100101 )
0 commit comments