diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 7974d1d..edd527c 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -2,37 +2,20 @@ import FooterMinimal from '@/components/sections/footer/FooterMinimal'; import NavbarFloatingLogo from '@/components/ui/NavbarFloatingLogo'; import SectionErrorBoundary from "@/components/ui/SectionErrorBoundary"; import SiteBackgroundSlot from "@/components/ui/SiteBackgroundSlot"; -import { Facebook, Instagram, Twitter } from "lucide-react"; import { Outlet } from 'react-router-dom'; import { StyleProvider } from "@/components/ui/StyleProvider"; export default function Layout() { const navItems = [ - { - "name": "ספרי ילדים", "href": "#ספרי-ילדים" - }, - { - "name": "ספרי ילדים לקירוב", "href": "#ספרי-ילדים-לקירוב" - }, - { - "name": "ספרים יהדות בעברית", "href": "#יהדות-בעברית" - }, - { - "name": "עיתונים בעברית", "href": "#עיתונים" - }, - { - "name": "חסידות", "href": "#חסידות" - }, - { - "name": "שיעורים בווידאו", "href": "#שיעורים" - }, - { - "name": "אודות", "href": "#אודות" - }, - { - "name": "צרו קשר", "href": "#צרו-קשר" - } -]; + { name: "ספרי ילדים", href: "#ספרי-ילדים" }, + { name: "ספרי ילדים לקירוב", href: "#ספרי-ילדים-לקירוב" }, + { name: "ספרים יהדות בעברית", href: "#יהדות-בעברית" }, + { name: "עיתונים בעברית", href: "#עיתונים" }, + { name: "חסידות", href: "#חסידות" }, + { name: "שיעורים בווידאו", href: "#שיעורים" }, + { name: "אודות", href: "#אודות" }, + { name: "צרו קשר", href: "#צרו-קשר" } + ]; return ( @@ -42,7 +25,8 @@ export default function Layout() { logo="חסידה הלוי" logoImageSrc="https://storage.googleapis.com/webild/default/no-image.jpg?id=zsioej" ctaButton={{ - text: "לגלות עוד", href: "#ספרי-ילדים"}} + text: "לגלות עוד", href: "#ספרי-ילדים" + }} navItems={navItems} /> @@ -54,12 +38,9 @@ export default function Layout() { brand="חסידה הלוי © 2024. כל הזכויות שמורות." copyright="האתר הרשמי של חסידה הלוי" socialLinks={[ - { - icon: "Facebook"}, - { - icon: "Instagram"}, - { - icon: "Twitter"}, + { icon: "Facebook" }, + { icon: "Instagram" }, + { icon: "Twitter" } ]} /> diff --git a/src/components/sections/hero/HeroVideoExpand.tsx b/src/components/sections/hero/HeroVideoExpand.tsx index e0e7f08..f71c4fd 100644 --- a/src/components/sections/hero/HeroVideoExpand.tsx +++ b/src/components/sections/hero/HeroVideoExpand.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, useCallback } from 'react'; -const StaggerText = ({ text }: { text: string }) => ( - - {[...text].map((char, index) => ( - - {char} - - ))} - -); - -type HeroVideoExpandProps = { +interface HeroVideoExpandProps { title: string; - primaryButton: { text: string; href: string }; - secondaryButton: { text: string; href: string }; + videoSrc: string; onComplete?: () => void; -} & ({ imageSrc: string; videoSrc?: never } | { videoSrc: string; imageSrc?: never }); +} -const HeroVideoExpand = ({ - title, - videoSrc, - imageSrc, - primaryButton, - secondaryButton, - onComplete, -}: HeroVideoExpandProps) => { - const [showLoader, setShowLoader] = useState(true); - 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]); +export default function HeroVideoExpand({ title, videoSrc, onComplete }: HeroVideoExpandProps) { + const [isExpanded, setIsExpanded] = useState(false); + const handleComplete = useCallback(() => { + if (onComplete) onComplete(); + }, [onComplete]); useEffect(() => { - const expandTimer = setTimeout(() => setExpanded(true), 600); - const hideTimer = setTimeout(() => { - setShowLoader(false); - onComplete?.(); - }, 1500); - return () => { - clearTimeout(expandTimer); - clearTimeout(hideTimer); - }; - }, []); + if (isExpanded) { + handleComplete(); + } + }, [isExpanded, handleComplete]); return ( - <> - - {showLoader && ( - - - - - - )} - - -
- - - - -
- -
-
- - {title} - - -
- - - - - - - - - - -
-
-
-
- +
+

{title}

+
); -}; - -export default HeroVideoExpand; +}