'use client' import SectionHeader from '@/components/SectionHeader' import ServiceItem from '@/components/ServiceItem' import { clx } from '@/helpers/utils' import { FC, useState } from 'react' import { Swiper, SwiperSlide } from 'swiper/react' import { useGetCategories, useGetServicesByCategory } from './hooks/useProductData' import Image from 'next/image' const DanakServices: FC = () => { const [categoryId, setCategoryId] = useState('') const { data: categories } = useGetCategories() const { data } = useGetServicesByCategory(categoryId) return (
setCategoryId('')} className={clx( 'h-10 cursor-pointer rounded-full border-2 border-white bg-white/45 flex gap-2 justify-center items-center', '' === categoryId && 'bg-white' )}>
همه
{ categories?.data?.categories?.map((item) => { return (
setCategoryId(item.id)} className={clx( 'h-10 cursor-pointer rounded-full border-2 border-white bg-white/45 flex gap-2 justify-center items-center', item.id === categoryId && 'bg-white' )}>
{item.title}
{item.title}
) }) }
{data?.data?.services?.map((item) => { return (
) })}
) } export default DanakServices