"use client"; import { useEffect, useRef, useState } from "react"; import "./bell-ring.css"; /** * Bell Ring * A notification bell that rings like a real one: it swings from its hook and dies down, the * clapper swinging the other way a beat behind, while the count badge pops up a number. * Opening it clears the badge. */ type Props = { count: number; onOpen?: () => void; label?: string; className?: string }; export function BellRing({ count, onOpen, label = "Notifications", className = "" }: Props) { const [beat, setBeat] = useState(0); const prev = useRef(count); useEffect(() => { if (count > prev.current) setBeat((b) => b + 1); prev.current = count; }, [count]); return ( ); }