import { Box as ReakitBox } from 'reakit'; import { useClassName, createComponent, createElement, createHook } from '../utils'; import { ModalDisclosure, ModalDisclosureProps } from '../Modal'; import * as styles from './Drawer.styles'; export type LocalDrawerDisclosureProps = {}; export type DrawerDisclosureProps = ModalDisclosureProps & LocalDrawerDisclosureProps; const useProps = createHook>( (props, { themeKey }) => { const htmlProps = ModalDisclosure.useProps(props); const className = useClassName({ style: styles.DrawerDisclosure, styleProps: props, themeKey, prevClassName: htmlProps.className, }); return { ...htmlProps, className }; }, { themeKey: 'Drawer.Disclosure' } ); export const DrawerDisclosure = createComponent>( (props) => { const DrawerDisclosureProps = useProps(props); return createElement({ children: props.children, component: ReakitBox, use: props.use, htmlProps: DrawerDisclosureProps, }); }, { attach: { useProps, displayName: 'Drawer.Disclosure', }, defaultProps: { use: 'button', }, themeKey: 'Drawer.Disclosure', } );