From 9c8885f6db3c07014ced5e98336b00ba3f097591 Mon Sep 17 00:00:00 2001 From: Avent Chiu <65209258+sirAvent@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:09:07 -0700 Subject: [PATCH] Parallax (#14) * Finalize site for invites * mentor link * Parallax Effect on Hero --- src/components/hero/hero.js | 31 ++++++++++++++++++++------- src/components/navbar.js | 2 +- src/styles/components/Hero.module.css | 19 ++++++---------- src/styles/globals.css | 2 ++ 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/components/hero/hero.js b/src/components/hero/hero.js index 0902f06..7220e27 100644 --- a/src/components/hero/hero.js +++ b/src/components/hero/hero.js @@ -1,11 +1,26 @@ +import React, { useState, useEffect } from 'react'; import { FaCalendar, FaLocationArrow } from "react-icons/fa"; import styles from "../../styles/components/Hero.module.css"; export default function HeroSection() { + const [scrollValue, setScrollValue] = useState(0); + + useEffect(() => { + function handleScroll() { + setScrollValue(window.scrollY); + } + + window.addEventListener('scroll', handleScroll); + + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + return ( <> -
-
+
+

WebJam 2023

@@ -18,7 +33,7 @@ export default function HeroSection() {
-
+

November 13-17

@@ -29,7 +44,7 @@ export default function HeroSection() {
-
+

-
-
-
-
+
+
+
+
diff --git a/src/components/navbar.js b/src/components/navbar.js index 39f0ca1..5cf4926 100644 --- a/src/components/navbar.js +++ b/src/components/navbar.js @@ -24,7 +24,7 @@ export default function Navbar() { return (