import { PolymorphicComponentProps } from '@kalink-ui/dibbly'; import { ElementType, ReactNode } from 'react'; type ConditionalWrapperProps = PolymorphicComponentProps & { /** * If `true`, the provided `children` prop will be wrapped. */ condition: boolean; /** * The component to wrap if `condition` is `true`. */ children: ReactNode; }; export function ConditionalWrapper( props: ConditionalWrapperProps, ) { const { use: Comp = 'div', condition, children, ...rest } = props; return condition ? {children} : children; }