Files
3df875bd-3de5-46d4-bbca-c04…/src/components/sections/hero/HeroSplitVerticalMarquee.tsx
2026-05-05 11:48:58 +03:00

157 lines
5.8 KiB
TypeScript

import { motion } from "motion/react";
type HeroSplitVerticalMarqueeProps = {
tag: string;
title: string;
description: string;
primaryButton: { text: string; href: string };
secondaryButton: { text: string; href: string };
leftItems: ({ imageSrc: string; videoSrc?: never } | { videoSrc: string; imageSrc?: never })[];
rightItems: ({ imageSrc: string; videoSrc?: never } | { videoSrc: string; imageSrc?: never })[];
};
const HeroSplitVerticalMarquee = ({
tag,
title,
description,
primaryButton,
secondaryButton,
leftItems,
rightItems,
}: HeroSplitVerticalMarqueeProps) => {
return (
<section
data-webild-section="HeroSplitVerticalMarquee"
aria-label="Hero section"
className="relative flex items-center w-full h-fit md:h-svh pt-25 pb-20 md:py-0"
>
<div className="flex flex-col md:flex-row items-center gap-8 w-content-width mx-auto">
<div className="w-full md:w-1/2">
<div className="flex flex-col items-center md:items-start gap-3">
<motion.span
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-15%" }}
transition={{ duration: 0.6, ease: "easeOut" }}
className="card rounded-full px-3 py-1 mb-1 text-sm"
>
{tag}
</motion.span>
<motion.h1
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-15%" }}
transition={{ duration: 0.6, delay: 0.05, ease: "easeOut" }}
className="text-7xl 2xl:text-8xl font-medium text-center md:text-left text-balance"
>
{title}
</motion.h1>
<motion.p
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-15%" }}
transition={{ duration: 0.6, delay: 0.15, ease: "easeOut" }}
className="max-w-8/10 text-lg md:text-xl leading-tight text-center md:text-left"
>
{description}
</motion.p>
<div className="flex flex-wrap max-md:justify-center gap-3 mt-3">
<motion.a
href={primaryButton.href}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-15%" }}
transition={{ duration: 0.6, delay: 0.25, ease: "easeOut" }}
className="primary-button rounded-theme h-9 px-6 inline-flex items-center justify-center text-sm text-primary-cta-text"
>
{primaryButton.text}
</motion.a>
<motion.a
href={secondaryButton.href}
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-15%" }}
transition={{ duration: 0.6, delay: 0.35, ease: "easeOut" }}
className="secondary-button rounded-theme h-9 px-6 inline-flex items-center justify-center text-sm text-secondary-cta-text"
>
{secondaryButton.text}
</motion.a>
</div>
</div>
</div>
<motion.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-15%" }}
transition={{ duration: 0.6, delay: 0.2, ease: "easeOut" }}
className="w-full md:w-1/2 h-100 md:h-[75vh] flex gap-3 overflow-hidden"
>
<div className="flex-1 overflow-hidden mask-fade-y">
<div className="flex flex-col gap-3 animate-marquee-vertical">
{[...leftItems, ...leftItems, ...leftItems, ...leftItems].map((item, i) => (
<div
key={i}
className="shrink-0 aspect-square card rounded-theme overflow-hidden p-2 xl:p-3 2xl:p-4"
>
{item.videoSrc ? (
<video
src={item.videoSrc}
autoPlay
muted
loop
playsInline
aria-label="Hero media"
className="w-full h-full object-cover rounded-theme"
/>
) : (
<img
src={item.imageSrc}
alt=""
className="w-full h-full object-cover rounded-theme"
/>
)}
</div>
))}
</div>
</div>
<div className="flex-1 overflow-hidden mask-fade-y">
<div className="flex flex-col gap-3 animate-marquee-vertical-reverse">
{[...rightItems, ...rightItems, ...rightItems, ...rightItems].map((item, i) => (
<div
key={i}
className="shrink-0 aspect-square card rounded-theme overflow-hidden p-2 xl:p-3 2xl:p-4"
>
{item.videoSrc ? (
<video
src={item.videoSrc}
autoPlay
muted
loop
playsInline
aria-label="Hero media"
className="w-full h-full object-cover rounded-theme"
/>
) : (
<img
src={item.imageSrc}
alt=""
className="w-full h-full object-cover rounded-theme"
/>
)}
</div>
))}
</div>
</div>
</motion.div>
</div>
</section>
);
};
export default HeroSplitVerticalMarquee;