index.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Drawer } from 'antd'
  2. import type { DrawerProps } from 'antd'
  3. import type { PropsWithChildren, FC } from 'react'
  4. import styles from './index.less'
  5. type AnimateContentProps = {
  6. visible: boolean
  7. onVisibleChange: (visible: boolean) => void
  8. disableBreadcrumb?: boolean
  9. } & Omit<DrawerProps, 'visible' | 'onVisibleChange'>
  10. const AnimateContent: FC<PropsWithChildren<AnimateContentProps>> = ({
  11. visible,
  12. onVisibleChange,
  13. disableBreadcrumb = false,
  14. children,
  15. ...others
  16. }) => {
  17. return (
  18. <div className={styles.pageContainer}>
  19. <Drawer
  20. {...others}
  21. getContainer={false}
  22. visible={visible}
  23. push={false}
  24. onClose={() => onVisibleChange(false)}
  25. mask={false}
  26. width="calc(100vw - 256px)"
  27. style={{ right: '24px', top: `${!disableBreadcrumb ? 72 + 50 : 72}px` }}
  28. contentWrapperStyle={{
  29. height: `calc(100vh - 96px ${!disableBreadcrumb ? '- 50px' : ''})`
  30. }}
  31. // closeIcon={<Button onClick={() => onVisibleChange(false)}>返回</Button>}>
  32. >
  33. {visible ? children : null}
  34. </Drawer>
  35. </div>
  36. )
  37. }
  38. export default AnimateContent