index.tsx 571 B

12345678910111213141516171819202122232425262728293031323334
  1. import React from 'react';
  2. import Portal from '../Portal';
  3. import { Slide, Wrapper } from './styled';
  4. type Props = {
  5. anchor?: 'left' | 'top' | 'right' |'bottom';
  6. children: React.ReactNode;
  7. open?: boolean;
  8. zIndex?: number;
  9. };
  10. const Drawer: React.FC<Props> = ({
  11. anchor = 'bottom',
  12. children,
  13. open = false,
  14. zIndex = 3,
  15. }: Props) => (
  16. <Portal>
  17. <Slide
  18. open={open}
  19. anchor={anchor}
  20. data-testid="drawer"
  21. zIndex={zIndex}
  22. >
  23. <Wrapper>
  24. {children}
  25. </Wrapper>
  26. </Slide>
  27. </Portal>
  28. );
  29. export default Drawer;