index.tsx 527 B

123456789101112131415161718192021222324252627
  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 open={open} anchor={anchor} data-testid="drawer" zIndex={zIndex}>
  18. <Wrapper>{children}</Wrapper>
  19. </Slide>
  20. </Portal>
  21. );
  22. export default Drawer;