Created
March 28, 2019 17:34
-
-
Save majames/67d3c4b262dde7534315a7590b3db0d7 to your computer and use it in GitHub Desktop.
@material/react-drawer hacks
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
import DefaultDrawer, { DrawerProps } from "@material/react-drawer"; | |
// creating the styled component | |
const Wrapper = styled((props: DrawerProps) => ( | |
// HACK: workaround buggy drawer typings | |
<DefaultDrawer {...props as any} /> | |
))` | |
&& { | |
/* HACK: work around buggy drawer styles */ | |
position: fixed; | |
top: 0; | |
padding: ${p => p.theme.size.pad.m}; | |
} | |
`; | |
// usage in the render method... needed to portal | |
return ReactDOM.createPortal( | |
<Drawer isOpen={isOpen} {...renderProps} />, | |
document.body | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment