Files
moybeach-main/components/Services.tsx
T

108 lines
4.7 KiB
TypeScript

"use client";
import { motion } from "framer-motion";
import { Waves, UtensilsCrossed, Hotel, CalendarHeart } from "lucide-react";
import Image from "next/image";
export default function Services({ dict, dbServices }: { dict: any, dbServices?: any[] }) {
const defaultServices = [
{
title: dict.services.items.beach.title,
description: dict.services.items.beach.description,
icon: Waves,
image: "https://images.unsplash.com/photo-1519046904884-53103b34b206?auto=format&fit=crop&q=80&w=800",
},
{
title: dict.services.items.restaurant.title,
description: dict.services.items.restaurant.description,
icon: UtensilsCrossed,
image: "https://images.unsplash.com/photo-1544148103-0773bf10d330?auto=format&fit=crop&q=80&w=800",
},
{
title: dict.services.items.hotel.title,
description: dict.services.items.hotel.description,
icon: Hotel,
image: "https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?auto=format&fit=crop&q=80&w=800",
},
{
title: dict.services.items.events.title,
description: dict.services.items.events.description,
icon: CalendarHeart,
image: "https://images.unsplash.com/photo-1511285560929-80b456fea0bc?auto=format&fit=crop&q=80&w=800",
},
];
const displayServices = dbServices && dbServices.length > 0
? dbServices.map(s => ({
title: s.title,
description: s.description,
icon: null, // Dynamic services don't have static icons right now
image: s.iconUrl || "https://images.unsplash.com/photo-1519046904884-53103b34b206?auto=format&fit=crop&q=80&w=800"
}))
: defaultServices;
return (
<section id="services" className="py-24 bg-white text-sea-dark">
<div className="container mx-auto px-6 max-w-7xl">
<div className="text-center mb-16">
<div className="flex items-center justify-center gap-3 mb-4">
<span className="w-8 h-px bg-coral" />
<h2 className="text-sm font-bold tracking-widest uppercase text-coral">{dict.services.title}</h2>
<span className="w-8 h-px bg-coral" />
</div>
<h3 className="text-4xl md:text-5xl font-serif">{dict.services.heading}</h3>
</div>
<div className={`grid gap-8 justify-center ${
displayServices.length === 1 ? 'grid-cols-1 max-w-sm mx-auto' :
displayServices.length === 2 ? 'md:grid-cols-2 max-w-3xl mx-auto' :
displayServices.length === 3 ? 'md:grid-cols-3 max-w-5xl mx-auto' :
'md:grid-cols-2 lg:grid-cols-4'
}`}>
{displayServices.map((service, index) => (
<motion.div
key={service.title}
initial={{ opacity: 0, y: 30 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-50px" }}
transition={{ duration: 0.6, delay: index * 0.1 }}
className="group cursor-pointer"
>
{/* Image card with gradient border on hover */}
<div className="relative mb-6">
{/* Border beam — visible on hover */}
<div className="absolute -inset-[1px] rounded-2xl bg-gradient-to-br from-coral/0 to-coral/0 group-hover:from-coral/50 group-hover:to-sea-light/40 transition-all duration-500 opacity-0 group-hover:opacity-100 z-0" />
<div className="relative h-80 overflow-hidden rounded-2xl shadow-md group-hover:shadow-lg group-hover:shadow-coral/15 transition-shadow duration-500 z-10">
<div className="absolute inset-0 bg-sea-dark/20 group-hover:bg-transparent transition-colors duration-500 z-10" />
<Image
src={service.image}
alt={service.title}
fill
className="object-cover transform group-hover:scale-110 transition-transform duration-700"
sizes="(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 25vw"
/>
{/* Icon badge */}
{service.icon && (
<div className="absolute top-4 left-4 z-20 bg-white/90 backdrop-blur-sm p-3 rounded-full shadow-lg ring-2 ring-coral/10 group-hover:ring-coral/50 transition-all duration-300">
<service.icon className="w-5 h-5 text-coral" />
</div>
)}
</div>
</div>
<h4 className="text-xl font-serif mb-2 group-hover:text-coral transition-colors duration-300">
{service.title}
</h4>
<p className="text-sm text-gray-500 leading-relaxed">{service.description}</p>
</motion.div>
))}
</div>
</div>
</section>
);
}