Created
July 16, 2019 14:54
-
-
Save sibelius/85ffcd79ef6513c00410fdb321126a08 to your computer and use it in GitHub Desktop.
how to use styled-components instead of clsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const styles = theme => ({ | |
drawer: { | |
position: 'absolute', | |
overflowX: 'hidden', | |
zIndex: theme.zIndex.drawer + 2, | |
[theme.breakpoints.up('sm')]: { | |
position: 'relative', | |
width: drawerWidth, | |
flexShrink: 0, | |
zIndex: theme.zIndex.drawer, | |
}, | |
whiteSpace: 'nowrap', | |
}, | |
drawerOpen: { | |
width: drawerWidth, | |
transition: theme.transitions.create('width', { | |
easing: theme.transitions.easing.sharp, | |
duration: theme.transitions.duration.enteringScreen, | |
}), | |
}, | |
drawerClose: { | |
transition: theme.transitions.create('width', { | |
easing: theme.transitions.easing.sharp, | |
duration: theme.transitions.duration.leavingScreen, | |
}), | |
overflowX: 'hidden', | |
width: 0, | |
[theme.breakpoints.up('sm')]: { | |
width: theme.spacing.unit * 9 + 1, | |
}, | |
}, | |
}); | |
<Drawer | |
variant="permanent" | |
open={isOpen} | |
className={clsx(classes.drawer, { | |
[classes.drawerOpen]: isOpen, | |
[classes.drawerClose]: !isOpen, | |
})} | |
classes={{ | |
paper: clsx({ | |
[classes.drawerOpen]: isOpen, | |
[classes.drawerClose]: !isOpen, | |
}), | |
}} | |
> | |
</Drawer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment