import { getClassNames } from '@websolutespa/bom-core'; import { ReactNode, useContext } from 'react'; import styled from 'styled-components'; import { getVariantKey } from '../../variants'; import { getCssResponsive } from '../utils'; import { DrawerContext } from './drawer.context'; import { IDrawerVariants, drawerVariants } from './drawer.variants'; const DrawerSubtitleStyle = styled.div` ${props => getVariantKey('subtitle', props.variant, props.variants)} ${props => getCssResponsive(props)} `; export type DrawerSubtitleProps = { className?: string; variant?: keyof typeof drawerVariants | (string & {}); variants?: IDrawerVariants; children?: ReactNode; }; export const DrawerSubtitle = ({ children, className, variant, variants, ...props }: DrawerSubtitleProps) => { const classNames = getClassNames('drawer__subtitle', className); const context = useContext(DrawerContext); if (!context) { return; } return ( {children} ); }; DrawerSubtitle.displayName = 'DrawerSubtitle';