Compare commits
8 Commits
version_2_
...
version_6_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18776dd778 | ||
| bc1bd652b0 | |||
|
|
1ff31b5d08 | ||
| 1732a985b3 | |||
|
|
91dde837af | ||
| 0efd3fbeaf | |||
|
|
f4bc14b49f | ||
| 5bd5d5f15f |
@@ -1,17 +1,295 @@
|
||||
// Created by add_section_from_catalog (TestimonialMarqueeCards).
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck — generated by catalog-eject; runtime-correct but TS strict-mode false-positives on inlined catalog body
|
||||
import Button from "@/components/ui/Button";
|
||||
import TextAnimation from "@/components/ui/TextAnimation";
|
||||
import ImageOrVideo from "@/components/ui/ImageOrVideo";
|
||||
import ScrollReveal from "@/components/ui/ScrollReveal";
|
||||
import { BadgeCheck } from "lucide-react";
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
|
||||
import React from 'react';
|
||||
import TestimonialMarqueeCards from '@/components/sections/testimonial/TestimonialMarqueeCards';
|
||||
const DraggableMarqueeRow = ({ items, duration, reverse = false }: { items: any[], duration: string, reverse?: boolean }) => {
|
||||
const containerRef = useRef(null);
|
||||
const trackRef = useRef(null);
|
||||
const isInitialized = useRef(false);
|
||||
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const [startX, setStartX] = useState(0);
|
||||
const [scrollLeft, setScrollLeft] = useState(0);
|
||||
|
||||
export default function TestimonialsSection(): React.JSX.Element {
|
||||
useEffect(() => {
|
||||
let animationFrameId: number;
|
||||
let lastTime = performance.now();
|
||||
|
||||
const durationMs = parseFloat(duration) * 1000;
|
||||
|
||||
const animate = (time: number) => {
|
||||
const deltaTime = time - lastTime;
|
||||
lastTime = time;
|
||||
|
||||
if (containerRef.current && trackRef.current) {
|
||||
const container = containerRef.current as any;
|
||||
const track = trackRef.current as any;
|
||||
const singleCopyWidth = track.scrollWidth / 4;
|
||||
|
||||
if (singleCopyWidth > 0) {
|
||||
if (!isInitialized.current) {
|
||||
if (reverse) {
|
||||
container.scrollLeft = singleCopyWidth * 2;
|
||||
}
|
||||
isInitialized.current = true;
|
||||
}
|
||||
|
||||
if (!isHovered && !isDragging) {
|
||||
const speed = singleCopyWidth / durationMs;
|
||||
const delta = speed * deltaTime;
|
||||
|
||||
if (reverse) {
|
||||
container.scrollLeft -= delta;
|
||||
if (container.scrollLeft <= 0) {
|
||||
container.scrollLeft += singleCopyWidth * 2;
|
||||
}
|
||||
} else {
|
||||
container.scrollLeft += delta;
|
||||
if (container.scrollLeft >= singleCopyWidth * 2) {
|
||||
container.scrollLeft -= singleCopyWidth * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
animationFrameId = requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
animationFrameId = requestAnimationFrame(animate);
|
||||
return () => cancelAnimationFrame(animationFrameId);
|
||||
}, [isHovered, isDragging, duration, reverse]);
|
||||
|
||||
const handleMouseDown = (e: React.MouseEvent) => {
|
||||
if (!containerRef.current) return;
|
||||
setIsDragging(true);
|
||||
setStartX(e.pageX - (containerRef.current as any).offsetLeft);
|
||||
setScrollLeft((containerRef.current as any).scrollLeft);
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
setIsDragging(false);
|
||||
setIsHovered(false);
|
||||
};
|
||||
|
||||
const handleMouseUp = () => {
|
||||
setIsDragging(false);
|
||||
};
|
||||
|
||||
const handleMouseMove = (e: React.MouseEvent) => {
|
||||
if (!isDragging || !containerRef.current || !trackRef.current) return;
|
||||
e.preventDefault();
|
||||
const x = e.pageX - (containerRef.current as any).offsetLeft;
|
||||
const walk = (x - startX) * 2;
|
||||
|
||||
let newScrollLeft = scrollLeft - walk;
|
||||
const singleCopyWidth = (trackRef.current as any).scrollWidth / 4;
|
||||
|
||||
if (singleCopyWidth > 0) {
|
||||
if (newScrollLeft <= 0) {
|
||||
newScrollLeft += singleCopyWidth * 2;
|
||||
setStartX(e.pageX - (containerRef.current as any).offsetLeft);
|
||||
setScrollLeft(newScrollLeft + walk);
|
||||
} else if (newScrollLeft >= singleCopyWidth * 2) {
|
||||
newScrollLeft -= singleCopyWidth * 2;
|
||||
setStartX(e.pageX - (containerRef.current as any).offsetLeft);
|
||||
setScrollLeft(newScrollLeft + walk);
|
||||
}
|
||||
}
|
||||
|
||||
(containerRef.current as any).scrollLeft = newScrollLeft;
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="overflow-hidden mask-fade-x cursor-grab active:cursor-grabbing"
|
||||
ref={containerRef}
|
||||
onMouseEnter={() => setIsHovered(true)}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
onMouseDown={handleMouseDown}
|
||||
onMouseUp={handleMouseUp}
|
||||
onMouseMove={handleMouseMove}
|
||||
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}
|
||||
>
|
||||
<div
|
||||
ref={trackRef}
|
||||
className="flex w-max mb-5"
|
||||
>
|
||||
{[...items, ...items, ...items, ...items].map((item, i) => (
|
||||
<div key={i} className="flex-none w-[300px] md:w-[400px] mx-2.5">
|
||||
<div className="card rounded-lg p-6 h-full flex flex-col justify-between">
|
||||
<div>
|
||||
<p className="text-lg md:text-xl text-foreground mb-6">"{item.quote}"</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-12 h-12 rounded-full overflow-hidden flex-shrink-0">
|
||||
<ImageOrVideo imageSrc={item.imageSrc} videoSrc={item.videoSrc} className="w-full h-full object-cover" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-1">
|
||||
<p className="font-semibold text-foreground">{item.name}</p>
|
||||
<BadgeCheck className="w-4 h-4 text-blue-500" />
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">{item.role}</p>
|
||||
</div>
|
||||
<Button text="Contact" variant="secondary" className="text-xs px-3 py-1" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const testimonials = [
|
||||
{
|
||||
imageSrc: "http://img.b2bpic.net/free-photo/woman-sitting-couch_23-2148751504.jpg",
|
||||
quote: "The design team turned my outdated flat into a modern masterpiece. Truly exceptional quality.",
|
||||
role: "Salamanca Resident",
|
||||
name: "Elena R."
|
||||
},
|
||||
{
|
||||
imageSrc: "http://img.b2bpic.net/free-photo/overhead-view-young-couple-with-their-baby-sitting-cardboard-boxes-their-new-home_23-2148060078.jpg",
|
||||
quote: "They captured our vision perfectly. The attention to detail is unmatched in Madrid.",
|
||||
role: "Villa Owner",
|
||||
name: "Carlos M."
|
||||
},
|
||||
{
|
||||
imageSrc: "http://img.b2bpic.net/free-photo/portrait-beautiful-woman-bathrobe-indoors_1153-8058.jpg",
|
||||
quote: "A seamless process from concept to completion. I couldn't be happier with the results.",
|
||||
name: "Sofia G.",
|
||||
role: "Art Collector"
|
||||
},
|
||||
{
|
||||
imageSrc: "http://img.b2bpic.net/free-photo/lovely-woman-drawing-looking-camera_23-2147770011.jpg",
|
||||
quote: "Their eye for texture and balance is superb. Highly recommended for any interior project.",
|
||||
role: "Architect",
|
||||
name: "Diego V."
|
||||
},
|
||||
{
|
||||
imageSrc: "http://img.b2bpic.net/free-photo/colleagues-smiling-speaking-discussing-new-ideas_176420-1665.jpg",
|
||||
quote: "Simply wonderful to work with. They made the renovation process stress-free and exciting.",
|
||||
role: "Business Owner",
|
||||
name: "Isabel P."
|
||||
}
|
||||
];
|
||||
|
||||
type Testimonial = {
|
||||
name: string;
|
||||
role: string;
|
||||
quote: string;
|
||||
} & ({ imageSrc: string; videoSrc?: never } | { videoSrc: string; imageSrc?: never });
|
||||
|
||||
const TestimonialsInline = () => {
|
||||
const half = Math.ceil(testimonials.length / 2);
|
||||
const topRow = testimonials.slice(0, half);
|
||||
const bottomRow = testimonials.slice(half);
|
||||
|
||||
return (
|
||||
<section aria-label="Testimonials section" className="pt-20 pb-10">
|
||||
<div className="flex flex-col gap-8 md:gap-10">
|
||||
<div className="flex flex-col items-center gap-2 w-content-width mx-auto">
|
||||
<div className="px-3 py-1 mb-1 text-sm card rounded w-fit">
|
||||
<p>{"Client Stories"}</p>
|
||||
</div>
|
||||
|
||||
<TextAnimation
|
||||
text={"What Homeowners Say"}
|
||||
variant="fade"
|
||||
gradientText={true}
|
||||
tag="h2"
|
||||
className="md:max-w-8/10 text-6xl 2xl:text-7xl leading-[1.15] font-semibold text-center text-balance"
|
||||
/>
|
||||
|
||||
<TextAnimation
|
||||
text={"Our passion is building your dream."}
|
||||
variant="fade"
|
||||
gradientText={false}
|
||||
tag="p"
|
||||
className="md:max-w-7/10 text-lg md:text-xl leading-snug text-center text-balance"
|
||||
/>
|
||||
|
||||
{(undefined || undefined) && (
|
||||
<div className="flex flex-wrap justify-center gap-3 mt-2 md:mt-3">
|
||||
{undefined && <Button text={undefined.text} href={undefined.href} variant="primary"/>}
|
||||
{undefined && <Button text={undefined.text} href={undefined.href} variant="secondary"animationDelay={0.1} />}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ScrollReveal variant="fade-blur" className="flex flex-col w-content-width mx-auto">
|
||||
<div className="overflow-hidden mask-fade-x">
|
||||
<div className="flex w-max animate-marquee-horizontal mb-5" style={{ animationDuration: "30s" }}>
|
||||
{[...topRow, ...topRow, ...topRow, ...topRow].map((testimonial, index) => (
|
||||
<div key={`top-${index}`} className="flex flex-col justify-between gap-4 xl:gap-5 2xl:gap-6 shrink-0 w-72 md:w-80 mr-5 p-6 xl:p-7 2xl:p-8 rounded card">
|
||||
<p className="text-lg leading-snug line-clamp-3">{testimonial.quote}</p>
|
||||
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<ImageOrVideo
|
||||
imageSrc={testimonial.imageSrc}
|
||||
videoSrc={testimonial.videoSrc}
|
||||
className="size-10 md:size-11 2xl:size-12 rounded-full object-cover"
|
||||
/>
|
||||
<div className="flex flex-col min-w-0">
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="text-base text-foreground font-semibold leading-snug truncate">{testimonial.name}</span>
|
||||
<BadgeCheck className="size-4 text-blue-500 shrink-0" />
|
||||
</div>
|
||||
<span className="text-base text-foreground/75 leading-snug truncate">{testimonial.role}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button text="Contact" variant="secondary" className="w-full py-2 text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="overflow-hidden mask-fade-x">
|
||||
<div className="flex w-max animate-marquee-horizontal-reverse mb-10" style={{ animationDuration: "30s" }}>
|
||||
{[...bottomRow, ...bottomRow, ...bottomRow, ...bottomRow].map((testimonial, index) => (
|
||||
<div key={`bottom-${index}`} className="flex flex-col justify-between gap-4 xl:gap-5 2xl:gap-6 shrink-0 w-72 md:w-80 mr-5 p-6 xl:p-7 2xl:p-8 rounded card">
|
||||
<p className="text-lg leading-snug line-clamp-3">{testimonial.quote}</p>
|
||||
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<ImageOrVideo
|
||||
imageSrc={testimonial.imageSrc}
|
||||
videoSrc={testimonial.videoSrc}
|
||||
className="size-10 md:size-11 2xl:size-12 rounded-full object-cover"
|
||||
/>
|
||||
<div className="flex flex-col min-w-0">
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="text-base text-foreground font-semibold leading-snug truncate">{testimonial.name}</span>
|
||||
<BadgeCheck className="size-4 text-blue-500 shrink-0" />
|
||||
</div>
|
||||
<span className="text-base text-foreground/75 leading-snug truncate">{testimonial.role}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button text="Contact" variant="secondary" className="w-full py-2 text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default function TestimonialsSection() {
|
||||
return (
|
||||
<div data-webild-section="testimonials" id="testimonials">
|
||||
<TestimonialMarqueeCards
|
||||
description="Our passion is building your dream."
|
||||
testimonials={[{"imageSrc":"http://img.b2bpic.net/free-photo/woman-sitting-couch_23-2148751504.jpg","quote":"The design team turned my outdated flat into a modern masterpiece. Truly exceptional quality.","role":"Salamanca Resident","name":"Elena R."},{"imageSrc":"http://img.b2bpic.net/free-photo/overhead-view-young-couple-with-their-baby-sitting-cardboard-boxes-their-new-home_23-2148060078.jpg","quote":"They captured our vision perfectly. The attention to detail is unmatched in Madrid.","role":"Villa Owner","name":"Carlos M."},{"imageSrc":"http://img.b2bpic.net/free-photo/portrait-beautiful-woman-bathrobe-indoors_1153-8058.jpg","quote":"A seamless process from concept to completion. I couldn't be happier with the results.","name":"Sofia G.","role":"Art Collector"},{"imageSrc":"http://img.b2bpic.net/free-photo/lovely-woman-drawing-looking-camera_23-2147770011.jpg","quote":"Their eye for texture and balance is superb. Highly recommended for any interior project.","role":"Architect","name":"Diego V."},{"imageSrc":"http://img.b2bpic.net/free-photo/colleagues-smiling-speaking-discussing-new-ideas_176420-1665.jpg","quote":"Simply wonderful to work with. They made the renovation process stress-free and exciting.","role":"Business Owner","name":"Isabel P."}]}
|
||||
title="What Homeowners Say"
|
||||
tag="Client Stories"
|
||||
/>
|
||||
<TestimonialsInline />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user