import { Transition } from '@headlessui/react' import { useIsMounted } from '@crypto-dex-sdk/hooks' import classNames from 'classnames' import type { ElementType, FC, ReactNode } from 'react' interface AppearOnMountProps { as?: ElementType show?: boolean children: ((mounted: boolean) => ReactNode) | ReactNode enabled?: boolean className?: string } export const AppearOnMount: FC = ({ as = 'div', show, children, enabled = true, className }) => { const isMounted = useIsMounted() if (!enabled) return <>{typeof children === 'function' ? children(isMounted) : children} if (isMounted) { return (
{typeof children === 'function' ? children(isMounted) : children}
) } return <> }