import type { servicesSchema } from '@/content.config' import type { z } from 'astro:content' import { useCallback, useRef, useState } from 'react' import { type SwiperRef, SwiperSlide } from 'swiper/react' import { CharachteristicCard } from './CharachteristicCard' import { cn } from '@/libs/cn' import { SimpleSwiper } from '../swiper/SimpleSwiper' import React from 'react' export type ServicesProps = { services: z.infer[] } export const Services: React.FC = ({ services }) => { const swiperRef = useRef(null) const tagSwiper = useRef(null) const [serviceId, setServiceId] = useState(0) const selectedService = services[serviceId] const isSelected = (index: number) => index === serviceId const updateServiceHandler = useCallback((index: number) => { setServiceId(index) swiperRef.current?.swiper.slideTo(0) tagSwiper.current?.swiper.slideTo(index) }, []) return (
{services.map((service, index) => ( ))} {selectedService.charachteristics?.map((charachteristic, index) => ( ))}
) }