diff --git a/src/components/sounds/sounds.tsx b/src/components/sounds/sounds.tsx index 8e99751..6fc1a2c 100644 --- a/src/components/sounds/sounds.tsx +++ b/src/components/sounds/sounds.tsx @@ -20,6 +20,8 @@ export function Sounds({ functional, id, sounds }: SoundsProps) { const [showAll, setShowAll] = useLocalStorage(`${id}-show-more`, false); const [clickedMore, setClickedMore] = useState(false); + const [isAnimating, setIsAnimating] = useState(false); + const firstNewSound = useRef(null); useEffect(() => { @@ -30,7 +32,6 @@ export function Sounds({ functional, id, sounds }: SoundsProps) { }, [showAll, clickedMore]); const showMoreButton = useRef(null); - const [exitComplete, setExitComplete] = useState(false); const [hiddenSelections, setHiddenSelections] = useState<{ [key: string]: boolean; @@ -57,8 +58,10 @@ export function Sounds({ functional, id, sounds }: SoundsProps) { }, []); const toggleMore = () => { - setShowAll(prev => !prev); - setClickedMore(true); + if (!isAnimating) { + setShowAll(prev => !prev); + setClickedMore(true); + } }; const variants = mix(fade(), scale(0.9)); @@ -85,34 +88,28 @@ export function Sounds({ functional, id, sounds }: SoundsProps) { {sounds.length > 6 && ( - setExitComplete(true)} + )} );