108 lines
3.6 KiB
TypeScript
108 lines
3.6 KiB
TypeScript
import { motion } from "motion/react";
|
|
|
|
type AboutMediaOverlayProps = {
|
|
tag: string;
|
|
title: string;
|
|
description: string;
|
|
primaryButton?: { text: string; href: string };
|
|
secondaryButton?: { text: string; href: string };
|
|
} & ({ imageSrc: string; videoSrc?: never } | { videoSrc: string; imageSrc?: never });
|
|
|
|
const AboutMediaOverlay = ({
|
|
tag,
|
|
title,
|
|
description,
|
|
primaryButton,
|
|
secondaryButton,
|
|
imageSrc,
|
|
videoSrc,
|
|
}: AboutMediaOverlayProps) => {
|
|
return (
|
|
<section
|
|
data-webild-section="AboutMediaOverlay"
|
|
aria-label="About section"
|
|
className="relative w-full py-16 md:py-24"
|
|
>
|
|
<div className="relative flex items-center justify-center py-8 md:py-8 mx-auto w-content-width rounded-theme overflow-hidden">
|
|
<div className="absolute inset-0">
|
|
{videoSrc ? (
|
|
<video
|
|
src={videoSrc}
|
|
autoPlay
|
|
muted
|
|
loop
|
|
playsInline
|
|
aria-label="About video"
|
|
className="w-full h-full object-cover"
|
|
/>
|
|
) : (
|
|
<img
|
|
src={imageSrc}
|
|
alt=""
|
|
className="w-full h-full object-cover"
|
|
/>
|
|
)}
|
|
<div className="absolute inset-0 bg-foreground/40 backdrop-blur-xs pointer-events-none select-none" />
|
|
</div>
|
|
|
|
<div className="relative z-10 flex items-center justify-center px-5 py-8 mx-auto min-h-100 md:min-h-120 md:w-1/2 w-content-width">
|
|
<div className="flex flex-col items-center gap-2 text-center">
|
|
<motion.span
|
|
initial={{ opacity: 0, y: 20 }}
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
viewport={{ once: true, margin: "-15%" }}
|
|
transition={{ duration: 0.6, ease: "easeOut" }}
|
|
className="mb-1 px-3 py-1 text-sm card rounded-full"
|
|
>
|
|
{tag}
|
|
</motion.span>
|
|
|
|
<motion.h2
|
|
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-6xl font-medium text-balance text-primary-cta-text"
|
|
>
|
|
{title}
|
|
</motion.h2>
|
|
|
|
<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="text-base md:text-lg leading-tight text-primary-cta-text"
|
|
>
|
|
{description}
|
|
</motion.p>
|
|
|
|
{(primaryButton || secondaryButton) && (
|
|
<div className="flex flex-wrap justify-center gap-3 mt-3">
|
|
{primaryButton && (
|
|
<a
|
|
href={primaryButton.href}
|
|
className="primary-button rounded-theme h-9 px-6 inline-flex items-center justify-center text-sm text-primary-cta-text"
|
|
>
|
|
{primaryButton.text}
|
|
</a>
|
|
)}
|
|
{secondaryButton && (
|
|
<a
|
|
href={secondaryButton.href}
|
|
className="secondary-button rounded-theme h-9 px-6 inline-flex items-center justify-center text-sm text-secondary-cta-text"
|
|
>
|
|
{secondaryButton.text}
|
|
</a>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
};
|
|
|
|
export default AboutMediaOverlay;
|