Retour au catalogue
Customer Stories Carousel
Carousel de stories avec navigation, photo + texte. Transition animee entre les slides.
customer-storiesmedium Both Responsive a11y
elegantminimalsaasuniversalcarousel
Theme
"use client";
import { useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { ChevronLeft, ChevronRight, Quote } from "lucide-react";
interface Story {
companyName: string;
authorName: string;
authorRole: string;
quote: string;
imageSrc?: string;
}
interface CustomerStoriesCarouselProps {
title?: string;
subtitle?: string;
stories?: Story[];
}
const ease: [number, number, number, number] = [0.16, 1, 0.3, 1];
export default function CustomerStoriesCarousel({
title = "Histoires de clients",
subtitle = "",
stories = [],
}: CustomerStoriesCarouselProps) {
const [current, setCurrent] = useState(0);
const [direction, setDirection] = useState(0);
const goTo = (next: number) => {
setDirection(next > current ? 1 : -1);
setCurrent(next);
};
const prev = () => goTo(current === 0 ? stories.length - 1 : current - 1);
const next = () => goTo(current === stories.length - 1 ? 0 : current + 1);
if (stories.length === 0) return null;
const story = stories[current];
return (
<section className="py-20 lg:py-28 px-6" style={{ background: "var(--color-background)" }}>
<div className="mx-auto max-w-4xl">
<motion.div
initial={{ opacity: 0, y: 16 }}
whileInView={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, ease }}
viewport={{ once: true }}
className="text-center mb-12"
>
<h2 className="text-3xl md:text-4xl font-bold" style={{ color: "var(--color-foreground)" }}>
{title}
</h2>
{subtitle && (
<p className="mt-3 text-base" style={{ color: "var(--color-foreground-muted)" }}>{subtitle}</p>
)}
</motion.div>
<div className="relative">
<div
className="rounded-2xl overflow-hidden p-8 md:p-12"
style={{ background: "var(--color-background-card)", border: "1px solid var(--color-border)" }}
>
<AnimatePresence mode="wait" custom={direction}>
<motion.div
key={current}
custom={direction}
initial={{ opacity: 0, x: direction * 40 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: direction * -40 }}
transition={{ duration: 0.4, ease }}
className="grid grid-cols-1 md:grid-cols-[1fr_2fr] gap-8 items-center"
>
{/* Image or placeholder */}
<div
className="aspect-square rounded-xl overflow-hidden flex items-center justify-center"
style={{
background: story.imageSrc ? undefined : "var(--color-background-alt)",
border: story.imageSrc ? undefined : "1px dashed var(--color-border)",
}}
>
{story.imageSrc ? (
<img src={story.imageSrc} alt={story.authorName} className="w-full h-full object-cover" />
) : (
<span className="text-3xl font-bold" style={{ color: "var(--color-foreground-light)" }}>
{story.authorName[0]}
</span>
)}
</div>
{/* Quote */}
<div>
<Quote size={28} className="mb-4" style={{ color: "var(--color-accent)", opacity: 0.4 }} />
<p
className="text-base md:text-lg leading-relaxed italic"
style={{ color: "var(--color-foreground)", fontFamily: "var(--font-serif)" }}
>
{story.quote}
</p>
<div className="mt-6">
<p className="text-sm font-semibold" style={{ color: "var(--color-foreground)" }}>
{story.authorName}
</p>
<p className="text-xs mt-0.5" style={{ color: "var(--color-foreground-muted)" }}>
{story.authorRole} — {story.companyName}
</p>
</div>
</div>
</motion.div>
</AnimatePresence>
</div>
{/* Navigation */}
<div className="flex items-center justify-center gap-4 mt-8">
<button
onClick={prev}
className="flex items-center justify-center w-10 h-10 rounded-full transition-colors cursor-pointer"
style={{ border: "1px solid var(--color-border)", color: "var(--color-foreground-muted)" }}
>
<ChevronLeft size={18} />
</button>
<div className="flex gap-2">
{stories.map((_, i) => (
<button
key={i}
onClick={() => goTo(i)}
className="w-2 h-2 rounded-full transition-colors cursor-pointer"
style={{
background: i === current ? "var(--color-accent)" : "var(--color-border)",
}}
/>
))}
</div>
<button
onClick={next}
className="flex items-center justify-center w-10 h-10 rounded-full transition-colors cursor-pointer"
style={{ border: "1px solid var(--color-border)", color: "var(--color-foreground-muted)" }}
>
<ChevronRight size={18} />
</button>
</div>
</div>
</div>
</section>
);
}
Autres variantes customer-stories
Customer Stories Featured
medium · both
elegantcorporate
Customer Stories Grid
simple · both
minimalcorporate
Customer Stories Minimal
simple · both
minimalcorporate
Customer Stories Parallax
complex · both
boldelegant
Customer Stories Scroll
medium · both
elegantbold
Customer Story Before After
medium · both
boldplayful