From 64a44f7dcc7fffcec1a9d2ae69fd269f358d04d2 Mon Sep 17 00:00:00 2001 From: Chuma McPhoy Date: Fri, 23 Aug 2024 08:15:38 +0200 Subject: [PATCH] fix(SW-96): use function declarations --- components/Lightbox/Gallery.tsx | 4 ++-- components/Lightbox/index.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/Lightbox/Gallery.tsx b/components/Lightbox/Gallery.tsx index 5134ecf29..22ac59c0b 100644 --- a/components/Lightbox/Gallery.tsx +++ b/components/Lightbox/Gallery.tsx @@ -31,12 +31,12 @@ export default function Gallery({ return thumbs } - const handleNext = () => { + function handleNext() { const nextIndex = (mainImageIndex + 1) % images.length onSelectImage(images[nextIndex]) } - const handlePrev = () => { + function handlePrev() { const prevIndex = (mainImageIndex - 1 + images.length) % images.length onSelectImage(images[prevIndex]) } diff --git a/components/Lightbox/index.tsx b/components/Lightbox/index.tsx index 95709d2ad..3ac645235 100644 --- a/components/Lightbox/index.tsx +++ b/components/Lightbox/index.tsx @@ -15,7 +15,7 @@ export default function Lightbox({ images, children }: LightboxProps) { const [selectedImageIndex, setSelectedImageIndex] = useState(0) const [isFullView, setIsFullView] = useState(false) - const handleOpenChange = (open: boolean) => { + function handleOpenChange(open: boolean) { if (!open) { setTimeout(() => { setIsOpen(false) @@ -27,11 +27,11 @@ export default function Lightbox({ images, children }: LightboxProps) { } } - const handleNext = () => { + function handleNext() { setSelectedImageIndex((prevIndex) => (prevIndex + 1) % images.length) } - const handlePrev = () => { + function handlePrev() { setSelectedImageIndex( (prevIndex) => (prevIndex - 1 + images.length) % images.length )