'use client'; import { useState } from 'react'; import Image from 'next/image'; interface SpecializationCardProps { title: string; items: string[]; icon: React.ReactNode; initialItemsToShow?: number; } export function SpecializationCard({ title, items, icon, initialItemsToShow = 3 }: SpecializationCardProps) { const [isExpanded, setIsExpanded] = useState(false); // Determine if we need to show the toggle button const hasMoreItems = items.length > initialItemsToShow; // Get the items to display based on expanded state const displayedItems = isExpanded ? items : items.slice(0, initialItemsToShow); const handleToggle = () => { setIsExpanded(!isExpanded); }; return (
{icon}

{title}

{displayedItems.map((item, idx) => (

{item}

))}
{hasMoreItems && (
)}
); }