import { useRef } from "react"; import { motion, useScroll, useTransform } from "motion/react"; import Button from "@/components/ui/Button"; import TextAnimation from "@/components/ui/TextAnimation"; import ImageOrVideo from "@/components/ui/ImageOrVideo"; type AboutParallaxProps = { tag: string; title: string; description: string; primaryButton?: { text: string; href: string }; secondaryButton?: { text: string; href: string }; badge?: string; } & ({ frontImageSrc: string; frontVideoSrc?: never } | { frontVideoSrc: string; frontImageSrc?: never }) & ({ backImageSrc: string; backVideoSrc?: never } | { backVideoSrc: string; backImageSrc?: never }); const AboutParallax = ({ tag, title, description, primaryButton, secondaryButton, frontImageSrc, frontVideoSrc, backImageSrc, backVideoSrc, badge }: AboutParallaxProps) => { const sectionRef = useRef(null); const { scrollYProgress } = useScroll({ target: sectionRef, offset: ["start end", "end start"], }); const fgY = useTransform(scrollYProgress, [0, 1], ["120px", "-120px"]); const bgY = useTransform(scrollYProgress, [0, 1], ["-60px", "60px"]); const bgScale = useTransform(scrollYProgress, [0, 1], [1, 1.15]); return (

{tag}

{(primaryButton || secondaryButton) && (
{primaryButton &&
)}
{badge && ( {badge} )}
); }; export default AboutParallax;