From 9718ec77e4bfff16810ec52a56717696ebed422b Mon Sep 17 00:00:00 2001 From: bender Date: Sun, 21 Jun 2026 12:38:53 +0000 Subject: [PATCH] Update src/components/sections/hero/HeroExpand.tsx --- src/components/sections/hero/HeroExpand.tsx | 158 +++----------------- 1 file changed, 22 insertions(+), 136 deletions(-) diff --git a/src/components/sections/hero/HeroExpand.tsx b/src/components/sections/hero/HeroExpand.tsx index dedb1fc..8895dea 100644 --- a/src/components/sections/hero/HeroExpand.tsx +++ b/src/components/sections/hero/HeroExpand.tsx @@ -1,146 +1,32 @@ -import { useEffect, useRef, useState } from "react"; -import { AnimatePresence, motion, useScroll, useTransform } from "motion/react"; -import ImageOrVideo from "@/components/ui/ImageOrVideo"; -import AutoFillText from "@/components/ui/AutoFillText"; -import { useButtonClick } from "@/hooks/useButtonClick"; +import { useState, useEffect } from 'react'; +import { motion, AnimatePresence } from 'framer-motion'; -const StaggerText = ({ text }: { text: string }) => ( - - {[...text].map((char, index) => ( - - {char} - - ))} - -); - -type HeroExpandProps = { +interface HeroExpandProps { title: string; - primaryButton: { text: string; href: string }; - secondaryButton: { text: string; href: string }; + description: string; onComplete?: () => void; -} & ({ imageSrc: string; videoSrc?: never } | { videoSrc: string; imageSrc?: never }); +} -const HeroExpand = ({ - title, - videoSrc, - imageSrc, - primaryButton, - secondaryButton, - onComplete, -}: HeroExpandProps) => { - const [showLoader, setShowLoader] = useState(true); +export default function HeroExpand({ title, description, onComplete }: HeroExpandProps) { const [expanded, setExpanded] = useState(false); - const handlePrimaryClick = useButtonClick(primaryButton.href); - const handleSecondaryClick = useButtonClick(secondaryButton.href); - - const sectionRef = useRef(null); - const { scrollYProgress } = useScroll({ - target: sectionRef, - offset: ["start start", "end start"], - }); - const videoY = useTransform(scrollYProgress, [0, 1], ["0px", "150px"]); - const videoScale = useTransform(scrollYProgress, [0, 1], [1, 1.1]); useEffect(() => { - const expandTimer = setTimeout(() => setExpanded(true), 600); - const hideTimer = setTimeout(() => { - setShowLoader(false); - onComplete?.(); - }, 1500); - return () => { - clearTimeout(expandTimer); - clearTimeout(hideTimer); - }; - }, []); + if (expanded && onComplete) { + onComplete(); + } + }, [expanded, onComplete]); return ( - <> - - {showLoader && ( - - - - - - )} - - -
- - - - -
- -
-
- - {title} - - -
- - - - - - - - - - -
-
-
-
- +
+ setExpanded(!expanded)} + className="cursor-pointer overflow-hidden bg-white p-8 rounded-xl shadow-lg" + > +

{title}

+

{description}

+
+
); -}; - -export default HeroExpand; +} -- 2.49.1