115 lines
3.6 KiB
TypeScript
115 lines
3.6 KiB
TypeScript
import React from 'react';
|
|
import Image from 'next/image'
|
|
import { cn, commonClasses } from '@/lib/utils';
|
|
import type { Service } from '@/types/service';
|
|
|
|
interface ServiceCardProps {
|
|
service: Service;
|
|
onServiceClick: (service: Service) => void;
|
|
className?: string;
|
|
}
|
|
|
|
// Composant pour l'icône de flèche factorisant la structure répétitive
|
|
const HoverArrow = () => (
|
|
<div className="mt-6 flex justify-center opacity-0 group-hover:opacity-100 transition-all duration-300 transform translate-y-2 group-hover:translate-y-0">
|
|
<div className="w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center shadow-lg">
|
|
<svg className="w-4 h-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
export const ServiceCard: React.FC<ServiceCardProps> = ({
|
|
service,
|
|
onServiceClick,
|
|
className = '',
|
|
}) => {
|
|
const handleClick = () => {
|
|
onServiceClick(service);
|
|
};
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
'group relative p-8 bg-white rounded-2xl',
|
|
'shadow-lg hover:shadow-2xl border border-gray-200 hover:border-blue-300',
|
|
commonClasses.transition,
|
|
'cursor-pointer transform hover:-translate-y-4',
|
|
commonClasses.hoverScale,
|
|
'active:scale-95',
|
|
className
|
|
)}
|
|
onClick={handleClick}
|
|
>
|
|
{/* Indicateur de survol */}
|
|
<div className="absolute inset-0 bg-gradient-to-br from-blue-50/50 to-indigo-50/50 rounded-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
|
|
|
|
{/* Contenu de la carte */}
|
|
<div className="relative z-10">
|
|
{/* Icône du service */}
|
|
<div className={cn(
|
|
'mb-8 w-24 h-24 rounded-2xl mx-auto',
|
|
'bg-gradient-to-br from-blue-500 to-blue-600',
|
|
'flex items-center justify-center shadow-xl',
|
|
'group-hover:shadow-2xl group-hover:scale-110',
|
|
commonClasses.transition
|
|
)}>
|
|
{service.iconType === 'image' ? (
|
|
<Image
|
|
src={service.image as string}
|
|
alt={service.name}
|
|
className={cn(
|
|
'h-12 w-12 object-contain',
|
|
'transition-transform duration-300 group-hover:scale-110'
|
|
)}
|
|
width={48}
|
|
height={48}
|
|
/>
|
|
) : service.lucideIcon ? (
|
|
<service.lucideIcon
|
|
className={cn(
|
|
'h-12 w-12 text-white',
|
|
'transition-transform duration-300 group-hover:scale-110'
|
|
)}
|
|
strokeWidth={1.5}
|
|
/>
|
|
) : (
|
|
<Image
|
|
src={service.image as any}
|
|
alt={service.icon}
|
|
className={cn(
|
|
'h-12 w-12',
|
|
'transition-transform duration-300 group-hover:scale-110'
|
|
)}
|
|
width={48}
|
|
height={48}
|
|
/>
|
|
)}
|
|
</div>
|
|
|
|
{/* Nom du service */}
|
|
<h3 className={cn(
|
|
'text-xl md:text-2xl font-bold mb-4 text-gray-900 text-center',
|
|
'group-hover:text-blue-700',
|
|
commonClasses.transition
|
|
)}>
|
|
{service.name}
|
|
</h3>
|
|
|
|
{/* Description courte */}
|
|
<p className={cn(
|
|
'text-gray-600 leading-relaxed text-center',
|
|
'group-hover:text-gray-700',
|
|
commonClasses.transition
|
|
)}>
|
|
{service.description.split('.')[0]}.
|
|
</p>
|
|
|
|
{/* Flèche indicatrice au hover */}
|
|
<HoverArrow />
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|