import { toComponent } from '../lib/cms/icon' import { toGradient, toTextColor } from '../lib/cms/color' import type { Enum_Componentsharedcolor_Value, Enum_Componentsharedicon_Value } from '../graphql/graphql' import type { Maybe } from '../lib/types' export interface ServiceCardCms { id: string title?: Maybe description?: Maybe icon?: Maybe<{ value?: Maybe }> color?: Maybe<{ value?: Maybe }> category?: Maybe<{ slug: string }> } export interface ServicesCmsData { title?: Maybe description?: Maybe cards?: Maybe>> } interface ServicesProps { data?: Maybe } export function Services({ data }: ServicesProps) { const title = data?.title ?? '' const description = data?.description ?? '' const cards = (data?.cards ?? []).filter((c): c is ServiceCardCms => Boolean(c)) if (!title && !description && cards.length === 0) { return null } return (

Услуги

{title ?

{title}

: null} {description ?

{description}

: null}
{cards.map((service, index) => { const Icon = toComponent(service.icon?.value) const gradient = toGradient(service.color?.value) const iconColor = toTextColor(service.color?.value) const floatClasses = [ 'animate-float', 'animate-float-delay-1', 'animate-float-delay-2', 'animate-float-delay-3', 'animate-float-delay-4', 'animate-float-delay-5', ] const floatClass = floatClasses[index % 6] const slug = service.category?.slug return (
{service.title ?

{service.title}

: null} {service.description ? (

{service.description}

) : null} {slug ? ( Подробнее → ) : ( Подробнее → )}
) })}
) }