From 7ad234ec3673a40413982b2c9e4cea320815aca7 Mon Sep 17 00:00:00 2001 From: Tony Marsella Date: Tue, 6 Jun 2023 17:16:48 -0700 Subject: [PATCH] Update to site --- components/layouts/navbar.jsx | 4 +- components/layouts/section.jsx | 67 +++++++++++++++++++++++------ components/layouts/sub-section.jsx | 2 +- package-lock.json | 9 ++++ package.json | 1 + pages/about.js | 27 ++++-------- pages/contactus.js | 6 +++ pages/getinvolved.js | 40 ++--------------- pages/index.js | 46 +++++++++----------- public/higher_ground_optimized.mp4 | Bin 0 -> 6233458 bytes public/true_freedom_optimized.mp4 | Bin 0 -> 6762655 bytes 11 files changed, 104 insertions(+), 98 deletions(-) create mode 100644 public/higher_ground_optimized.mp4 create mode 100644 public/true_freedom_optimized.mp4 diff --git a/components/layouts/navbar.jsx b/components/layouts/navbar.jsx index 64e41aa..a37a8ea 100644 --- a/components/layouts/navbar.jsx +++ b/components/layouts/navbar.jsx @@ -6,8 +6,8 @@ import NavItem from "./nav-item"; const MENU_LIST = [ { text: "about", href: "/about" }, { text: "get involved", href: "/getinvolved" }, - { text: "projects", href: "/projects" }, - { text: "hire us", href: "/hireus" }, + //{ text: "projects", href: "/projects" }, + //{ text: "hire us", href: "/hireus" }, { text: "contact us", href: "/contactus" }, ]; const Navbar = () => { diff --git a/components/layouts/section.jsx b/components/layouts/section.jsx index b0a4b3e..6d1b607 100644 --- a/components/layouts/section.jsx +++ b/components/layouts/section.jsx @@ -8,10 +8,12 @@ const Section = ({ videoId, buttonOneText, buttonTwoText, - buttonLink = "/", // add a default value, + buttonLink = "/", + headingLevel = 1, }) => { const videoRef = useRef(null); const [isPlaying, setIsPlaying] = useState(false); + const [hasInteracted, setHasInteracted] = useState(false); useEffect(() => { const options = { @@ -24,7 +26,9 @@ const Section = ({ entries.forEach((entry) => { if (entry.isIntersecting) { setIsPlaying(true); - videoRef.current?.play(); + if (!isMobile) { + videoRef.current?.play(); + } } else { setIsPlaying(false); videoRef.current?.pause(); @@ -43,28 +47,63 @@ const Section = ({ }; }, []); + let isMobile = false; + if (typeof window !== "undefined") { + isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); + } + + const handlePlayVideo = () => { + if (videoRef.current) { + videoRef.current.play(); + setHasInteracted(true); + } + }; + + const Heading = headingLevel === 1 ? "h1" : "h2"; + return (
-