import { useEffect, useState } from "react"; import AstralButton from "./AstralButton"; export default function ShareButton({ onShare }: { onShare: () => void }) { const [copied, setCopied] = useState(false); useEffect(() => { if (copied) { const timeout = setTimeout(() => setCopied(false), 2000); return () => clearTimeout(timeout); } }, [copied]); return copied ? ( Copied! ) : ( { setCopied(true); onShare(); }} > Share ); }