You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
883 B

2 years ago
2 years ago
2 years ago
  1. import { Flex } from 'antd'
  2. import { useStyle } from './style.ts'
  3. import React from 'react'
  4. export interface IClassProps {
  5. enabled: boolean
  6. className?: string
  7. description?: JSX.Element | React.ReactNode
  8. children?: JSX.Element | React.ReactNode
  9. }
  10. const Glass = (props: IClassProps) => {
  11. const { styles } = useStyle(props)
  12. if (!props.enabled) {
  13. return props.children
  14. }
  15. return (
  16. <div className={styles.container}>
  17. <Flex justify={'center'} align={'center'} className={styles.description}>
  18. {props.description}
  19. </Flex>
  20. <div className={styles.glass}/>
  21. {props.children}
  22. </div>
  23. )
  24. }
  25. export const withGlass = (Component: any) => (props) => {
  26. return (
  27. <Glass enabled={props.enabled}>
  28. <Component {...props as any} />
  29. </Glass>
  30. )
  31. }
  32. export default Glass