first commit
This commit is contained in:
120
app/components/TestimonialsSlider.tsx
Normal file
120
app/components/TestimonialsSlider.tsx
Normal file
@@ -0,0 +1,120 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
|
||||
const testimonials = [
|
||||
{
|
||||
name: "Ayşe Y.",
|
||||
location: "Türkiye",
|
||||
text: "Bardakçı Koyu'nun büyüleyici manzarasında unutulmaz bir tatil geçirdik. Personelin ilgisi ve otelin zarafeti bizi mest etti.",
|
||||
stars: 5
|
||||
},
|
||||
{
|
||||
name: "John D.",
|
||||
location: "United Kingdom",
|
||||
text: "An absolutely stunning resort. The spa treatment was world-class, and the breakfast by the sea was the highlight of our stay.",
|
||||
stars: 5
|
||||
},
|
||||
{
|
||||
name: "Klaus M.",
|
||||
location: "Germany",
|
||||
text: "Sehr schönes Hotel mit exzellentem Service. Der Privatstrand ist kristallklar ve sehr ruhig. Wir kommen auf jeden Fall wieder!",
|
||||
stars: 5
|
||||
},
|
||||
{
|
||||
name: "Elena S.",
|
||||
location: "Italy",
|
||||
text: "Un posto magico. La colazione è fantastica e la camera con vista mare ha superato le nostre aspettative. Grazie Salmakis!",
|
||||
stars: 5
|
||||
},
|
||||
{
|
||||
name: "Mehmet A.",
|
||||
location: "Türkiye",
|
||||
text: "Gastronomi anlamında gerçekten çok başarılı. Her akşam farklı bir lezzet şöleni yaşadık. Sahili ise kelimenin tam anlamıyla kusursuz.",
|
||||
stars: 5
|
||||
}
|
||||
];
|
||||
|
||||
export default function TestimonialsSlider() {
|
||||
const constraintsRef = useRef<HTMLDivElement>(null);
|
||||
const [width, setWidth] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (constraintsRef.current) {
|
||||
// Calculate how much we can drag: total width - container width
|
||||
setWidth(constraintsRef.current.scrollWidth - constraintsRef.current.offsetWidth);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<section className="bg-[#EAE5D8] py-24 overflow-hidden">
|
||||
<div className="max-w-7xl mx-auto px-6 mb-16">
|
||||
<div className="flex flex-col md:flex-row justify-between items-end gap-8">
|
||||
<div className="space-y-4">
|
||||
<span className="text-gold text-xs tracking-[0.4em] font-bold uppercase">
|
||||
MİSAFİR YORUMLARI
|
||||
</span>
|
||||
<h2 className="text-5xl md:text-7xl font-serif text-gray-900 leading-tight">
|
||||
Misafirlerimiz <br /> Ne Diyor?
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div className="max-w-md text-right md:text-right flex flex-col items-end gap-6 pb-4">
|
||||
<p className="text-gray-600 font-light leading-relaxed">
|
||||
Gerçek deneyimler ve samimi sözler. Salmakis Resort & Spa'daki anıların
|
||||
her türlü tanımdan daha fazlasını anlattığına inanıyoruz.
|
||||
</p>
|
||||
<button className="bg-[#C59D5F] text-white px-8 py-3 rounded-md text-[10px] font-bold tracking-[0.2em] hover:bg-gold transition-all uppercase">
|
||||
DENEYİMİNİZİ PAYLAŞIN
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Slider Container */}
|
||||
<div className="relative w-full overflow-hidden pb-10">
|
||||
<motion.div
|
||||
ref={constraintsRef}
|
||||
drag="x"
|
||||
dragConstraints={{ right: 0, left: -width }}
|
||||
dragElastic={0.1}
|
||||
whileTap={{ cursor: "grabbing" }}
|
||||
className="flex gap-6 px-6 md:px-[calc((100vw-1280px)/2)] cursor-grab whitespace-nowrap"
|
||||
initial={{ x: 100, opacity: 0 }}
|
||||
whileInView={{ x: 0, opacity: 1 }}
|
||||
transition={{ duration: 1 }}
|
||||
>
|
||||
{testimonials.map((item, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="min-w-[320px] md:min-w-[400px] bg-[#3A4D3F] p-10 flex flex-col justify-between h-[450px] shadow-2xl select-none"
|
||||
>
|
||||
<div className="space-y-6">
|
||||
<div className="flex gap-1">
|
||||
{[...Array(item.stars)].map((_, i) => (
|
||||
<span key={i} className="text-white text-sm">★</span>
|
||||
))}
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
<span className="text-white/40 text-[10px] tracking-widest font-bold uppercase">
|
||||
{item.location}
|
||||
</span>
|
||||
<p className="text-white/90 text-lg md:text-xl font-light leading-relaxed italic whitespace-normal">
|
||||
“{item.text}”
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="pt-6 border-t border-white/10">
|
||||
<span className="text-white text-xs tracking-[0.2em] font-bold uppercase">
|
||||
{item.name}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</motion.div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user