import { useState } from "react"; import { createPortal } from "react-dom"; import { ShrimpRain } from "./shrimp-rain"; export default function SeafoodButton() { const [showShrimpOverlay, setShowShrimpOverlay] = useState(false); // set maxShrimp based on image size so not to overflow const maxShrimp = 83; const shrimpRainValues: number[] = []; for (let i = 0; i < maxShrimp; i++) { shrimpRainValues.push(Math.floor(Math.random() * 200)); } function itsRainingShrimp() { setShowShrimpOverlay(true); // wait until after the animation plays to make the shrimp disappear 🪄 setTimeout(() => { setShowShrimpOverlay(false); }, 2900); } return ( <> {showShrimpOverlay && createPortal( , document.body )} ); } //todo nice to have: cooler button hover state - dancing shrimps