From 5d3743886bd315eec38b0434c9a5cf7b606a51b5 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Thu, 12 Sep 2024 17:22:24 +0200 Subject: [PATCH] feat(cava): animate only if music is being played --- src/components/Music/Cava.tsx | 13 +++++++++---- src/components/Music/index.tsx | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/Music/Cava.tsx b/src/components/Music/Cava.tsx index 932a186..ddc9d7f 100644 --- a/src/components/Music/Cava.tsx +++ b/src/components/Music/Cava.tsx @@ -2,9 +2,9 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { type InnerKittyProps } from "~/utils/types"; import { CHAR_WIDTH } from "../Kitty"; import { useKitty } from "~/hooks/useKitty"; +import { platform } from "os"; -// eslint-disable-next-line @typescript-eslint/ban-types -export const Cava = (_props: {}) => { +export const Cava = (props: { animate: boolean }) => { const kitty = useKitty(); return ( @@ -16,7 +16,7 @@ export const Cava = (_props: {}) => { gridTemplateRows: `1fr`, }} > - {kitty && } + {kitty && } ); }; @@ -150,6 +150,11 @@ const InnerCava = (props: InnerKittyProps) => { }, [calculateBarHeights]); return barHeights.map((height, i) => ( - + )); }; diff --git a/src/components/Music/index.tsx b/src/components/Music/index.tsx index 3c0444d..287892f 100644 --- a/src/components/Music/index.tsx +++ b/src/components/Music/index.tsx @@ -82,7 +82,7 @@ export const Music = () => { )} rows={5} > - + );