diff --git a/src/components/carousel.tsx b/src/components/carousel.tsx index 25c8203..7ef10c2 100644 --- a/src/components/carousel.tsx +++ b/src/components/carousel.tsx @@ -28,16 +28,8 @@ export default function Carousel({ images, className }: Props) { if (!isFocused || !emblaApi) return; const handleKeyDown = (event: KeyboardEvent) => { - switch (event.key) { - case "ArrowLeft": - emblaApi.scrollPrev(); - break; - case "ArrowRight": - emblaApi.scrollNext(); - break; - default: - break; - } + if (event.key === "ArrowLeft") emblaApi.scrollPrev(); + else if (event.key === "ArrowRight") emblaApi.scrollNext(); }; window.addEventListener("keydown", handleKeyDown); @@ -48,7 +40,7 @@ export default function Carousel({ images, className }: Props) { return (