diff --git a/src/blocks/ServicesDetailed/Component.tsx b/src/blocks/ServicesDetailed/Component.tsx index 8b3080d..011c919 100644 --- a/src/blocks/ServicesDetailed/Component.tsx +++ b/src/blocks/ServicesDetailed/Component.tsx @@ -1,4 +1,6 @@ +'use client' import React from 'react' +import { motion } from 'framer-motion' import { FileText, Calculator, @@ -9,6 +11,7 @@ import { Coins, LucideIcon, } from 'lucide-react' +import type { Page } from '../../payload-types' const iconMap: Record = { fileText: FileText, @@ -20,62 +23,82 @@ const iconMap: Record = { coins: Coins, } -export interface ServicesDetailedProps { - eyebrow?: string | null - title: string - subtitle?: string | null - services?: Array<{ - id?: string | null - title: string - description: string - icon?: string | null - }> | null -} +type Props = Extract[0], { blockType: 'servicesDetailed' }> -export const ServicesDetailedBlock: React.FC = ({ eyebrow, title, +export const ServicesDetailedBlock: React.FC = ({ + title, subtitle, services, }) => { + const serviceList = services || [] + const hasBento = serviceList.length >= 3 + return ( -
+
-
- {eyebrow && ( -
- // {eyebrow} -
- )} +

{title}

{subtitle && ( -

+

{subtitle}

)}
-
- {(services || []).map((service, index) => { +
+ {serviceList.map((service, index) => { const Icon = (service.icon && iconMap[service.icon]) || FileText + const isFirst = hasBento && index === 0 + const isSecondOrThird = hasBento && (index === 1 || index === 2) + + // Asymmetric Bento grid layout: + // 1st: col-span-6 on desktop, dark card + // 2nd & 3rd: col-span-3 on desktop, light card + // Remaining (4+): col-span-4 on desktop, light card + // Fallback (< 3 items): col-span-4 on desktop, light card + let colSpanClasses = 'col-span-1 sm:col-span-1 lg:col-span-4' + if (isFirst) { + colSpanClasses = 'col-span-1 sm:col-span-2 lg:col-span-6' + } else if (isSecondOrThird) { + colSpanClasses = 'col-span-1 sm:col-span-1 lg:col-span-3' + } return ( -
-
- +
+
-

+

{service.title}

-

- {service.description} -

-
+ +

+ {service.description} +

+ ) })}