index.tsx 501 B

123456789101112131415161718192021222324252627282930
  1. import React from 'react';
  2. import Portal from '../Portal';
  3. import { Slide, Container } from './styled';
  4. type Props = {
  5. anchor?: 'left' | 'top' | 'right' |'bottom';
  6. children: React.ReactNode;
  7. open: boolean;
  8. };
  9. const Drawer: React.FunctionComponent<Props> = ({
  10. anchor = 'bottom',
  11. children,
  12. open,
  13. }: Props) => (
  14. <Portal>
  15. <Slide
  16. open={open}
  17. anchor={anchor}
  18. >
  19. <Container>
  20. {children}
  21. </Container>
  22. </Slide>
  23. </Portal>
  24. );
  25. export default Drawer;