import * as Ariakit from '@ariakit/react'; import { getClassNames } from '@websolutespa/bom-core'; import { forwardRef, ReactNode, useContext } from 'react'; import styled from 'styled-components'; import { getVariantKey } from '../../variants'; import { UIStyledComponentProps } from '../types'; import { getCssResponsive } from '../utils'; import { DrawerContext } from './drawer.context'; import { drawerVariants, IDrawerVariants } from './drawer.variants'; const DrawerTitleStyle = styled(Ariakit.DialogHeading) ` ${props => getVariantKey('title', props.variant, props.variants)} ${props => getCssResponsive(props)} `; export type DrawerTitleProps = Ariakit.DialogHeadingProps & UIStyledComponentProps<{ className?: string; variant?: keyof typeof drawerVariants | (string & {}); variants?: IDrawerVariants; children?: ReactNode; }>; export const DrawerTitle = forwardRef( function DrawerTitle({ children, className, variant, variants, ...props }: DrawerTitleProps, ref) { const classNames = getClassNames('drawer__title', className); const context = useContext(DrawerContext); if (!context) { return; } return ( {children} ); });