'use client'; import Text from 'components/ui/text'; import { useEffect, useState } from 'react'; import CategoryCard from '@/components/ui/category-card/category-card'; import ProductCard from '@/components/ui/product-card/product-card'; import { Carousel, CarouselItem } from 'components/modules/carousel/carousel'; interface SliderProps { products: [] | any; title: string; categories: [] | any; sliderType: String; } const Slider = ({ products, categories, title, sliderType }: SliderProps) => { const [items, setItems] = useState([]); useEffect(() => { if (sliderType === 'products') setItems(products); else if (sliderType === 'categories') setItems(categories); }, []); return (
{title ? ( {title} ) : ( No title provided yet )} {items && ( {items.map((item: any, index: number) => ( {sliderType === 'products' && } {sliderType === 'categories' && } ))} )}
); }; export default Slider;