Skip to content

Instantly share code, notes, and snippets.

@majames
Created March 28, 2019 17:34
Show Gist options
  • Save majames/67d3c4b262dde7534315a7590b3db0d7 to your computer and use it in GitHub Desktop.
Save majames/67d3c4b262dde7534315a7590b3db0d7 to your computer and use it in GitHub Desktop.
@material/react-drawer hacks
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