import React, { memo, useState } from 'react' import styles from './Carousel.module.css' import LeftArrow from 'src/styling/icons/arrow/carousel-left-arrow.svg?react' import RightArrow from 'src/styling/icons/arrow/carousel-right-arrow.svg?react' export const Carousel = memo(({ photosData, slidePhoto }) => { const [activeIndex, setActiveIndex] = useState(0) const handlePrev = () => { const newIndex = activeIndex === 0 ? photosData.length - 1 : activeIndex - 1 setActiveIndex(newIndex) slidePhoto(newIndex) } const handleNext = () => { const newIndex = activeIndex === photosData.length - 1 ? 0 : activeIndex + 1 setActiveIndex(newIndex) slidePhoto(newIndex) } if (!photosData || photosData.length === 0) { return null } return (