import { useEffect, useState, type ReactNode } from 'react' // Viewport-fixed action bar that slides up when shown and — instead of // vanishing — slides back down before unmounting (kept in the tree for the // duration of the exit animation). export function FloatingBar({ show, children }: { show: boolean; children: ReactNode }) { const [render, setRender] = useState(show) useEffect(() => { if (show) { setRender(true) return } const t = setTimeout(() => setRender(false), 300) // match animation duration return () => clearTimeout(t) }, [show]) if (!render) return null return (
{children}
) }