Apply Now
ADD ME TO CART
+ADD ME TO CART
UP-GRADE 2024
@@ -119,38 +115,29 @@ export default function Navbar() {JUNE 1ST TO AUGUST 13TH
-
+
{'*'.repeat(numAstericks)}
- {links.map(link => (
+ {NAV_LINKS.map((link, index) => (
-
{
isHamburgerOpen ? toggleHamburger() : null;
+ setCurrPage(PAGE_TYPES[index]);
}}
>
- {link.text === currPage ? (
-
- ) : null}
-
+
{link.text.toUpperCase()}
-
{' '}
+
- {' '}
- .0{links.indexOf(link) + 1}{' '}
+ {`.0${index + 1}`}
@@ -158,7 +145,7 @@ export default function Navbar() {
))}
-
+
{'*'.repeat(numAstericks)}
@@ -179,23 +166,23 @@ export default function Navbar() {
-
+
ADD ME TO CART
diff --git a/src/app/components/Navbar/hooks/handleToggle.ts b/src/app/components/Navbar/hooks/handleToggle.ts
new file mode 100644
index 0000000..43b8f41
--- /dev/null
+++ b/src/app/components/Navbar/hooks/handleToggle.ts
@@ -0,0 +1,44 @@
+import { useState, useRef } from "react";
+
+type handleToggleProps = {
+ navContainerRef: React.RefObject;
+}
+
+export const handleToggle = ({navContainerRef}: handleToggleProps) => {
+ const hamburgerInnerRef = useRef(null);
+ const [isHamburgerOpen, setIsHamburgerOpen] = useState(false);
+
+ const toggleHamburger = () => {
+ console.log(navContainerRef.current?.classList)
+ navContainerRef.current?.classList.toggle("slideTransition")
+ console.log(navContainerRef.current?.classList)
+ setIsHamburgerOpen(!isHamburgerOpen);
+
+ if (!isHamburgerOpen) {
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === 'Escape') {
+ setIsHamburgerOpen(false);
+ document.body.style.overflow = 'auto';
+ document.removeEventListener('keydown', handleKeyDown);
+ }
+ };
+ document.querySelector('main')?.setAttribute('aria-hidden', 'true');
+ document.addEventListener('keydown', handleKeyDown);
+ document.body.style.overflow = 'hidden';
+ } else {
+ document.body.style.overflow = 'auto';
+ document.querySelector('main')?.removeAttribute('aria-hidden');
+ // Add transition to hamburger menu background color when closing navbar
+ if (hamburgerInnerRef.current) {
+ hamburgerInnerRef.current.style.transition =
+ 'transform 0.22s cubic-bezier(0.55, 0.055, 0.675, 0.19), background-color 0.3s';
+ hamburgerInnerRef.current.addEventListener('animationend', () => {
+ hamburgerInnerRef.current!.style.transition =
+ 'transform 0.22s cubic-bezier(0.55, 0.055, 0.675, 0.19)';
+ });
+ }
+ }
+ };
+
+ return {toggleHamburger, isHamburgerOpen, hamburgerInnerRef}
+}
\ No newline at end of file
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 7066133..35c1a87 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,3 +1,6 @@
+"use client";
+
+import React, { useRef } from 'react';
import './Home.scss';
import Landing from './pages/Landing/Landing';
@@ -7,21 +10,27 @@ import FAQ from './pages/FAQ/FAQ';
import Apply from './pages/Apply/Apply';
import Navbar from './components/Navbar/Navbar';
-{
- /* Scroll Refs */
-}
+export type PageRef = React.RefObject
+
+
+export default function Home() {
+ const mainRef = useRef(null);
+ const landingRef = useRef(null);
+ const overviewRef = useRef(null);
+ const themesRef = useRef(null);
+ const faqRef = useRef(null);
+ const applyRef = useRef(null);
-export default async function Home() {
return (
-
-
-
-
-
-
+
+
+
+
+
+
{/* Footer is inside Apply */}
-
+
);
diff --git a/src/app/pages/Apply/Apply.tsx b/src/app/pages/Apply/Apply.tsx
index fed31f5..a567dfc 100644
--- a/src/app/pages/Apply/Apply.tsx
+++ b/src/app/pages/Apply/Apply.tsx
@@ -1,9 +1,15 @@
import Footer from '@/components/Footer/Footer';
import './Apply.scss';
+import {PageRef} from '@/page'
-export default function Apply() {
+type ApplyProps = {
+ applyRef: PageRef;
+}
+
+
+export default function Apply({applyRef}: ApplyProps) {
return (
-
+
.05 / Apply
Why Apply?
diff --git a/src/app/pages/FAQ/FAQ.tsx b/src/app/pages/FAQ/FAQ.tsx
index 67cea5f..2207fb9 100644
--- a/src/app/pages/FAQ/FAQ.tsx
+++ b/src/app/pages/FAQ/FAQ.tsx
@@ -1,8 +1,13 @@
import './FAQ.scss';
+import {PageRef} from '@/page'
-export default function FAQ() {
+type FAQProps = {
+ faqRef: PageRef;
+}
+
+export default function FAQ({faqRef}: FAQProps) {
return (
-
+
.04 / FAQ
Commonly Asked Questions
diff --git a/src/app/pages/Landing/Landing.tsx b/src/app/pages/Landing/Landing.tsx
index 99d598a..ad05e2f 100644
--- a/src/app/pages/Landing/Landing.tsx
+++ b/src/app/pages/Landing/Landing.tsx
@@ -1,8 +1,13 @@
import './Landing.scss';
+import { PageRef } from '@/page'
-export default function Landing() {
+type LandingProps = {
+ landingRef: PageRef;
+}
+
+export default function Landing({landingRef} : LandingProps) {
return (
-
+
.01 / Home
);
diff --git a/src/app/pages/Overview/Overview.tsx b/src/app/pages/Overview/Overview.tsx
index afa5232..d986210 100644
--- a/src/app/pages/Overview/Overview.tsx
+++ b/src/app/pages/Overview/Overview.tsx
@@ -1,8 +1,13 @@
import './Overview.scss';
+import {PageRef} from '@/page'
-export default function Overview() {
+type OverviewProps = {
+ overviewRef: PageRef;
+}
+
+export default function Overview({overviewRef} : OverviewProps) {
return (
-
+
.02 / OVERVIEW
What is UP-Grade?
diff --git a/src/app/pages/Themes/Themes.tsx b/src/app/pages/Themes/Themes.tsx
index 50c4e59..22cc298 100644
--- a/src/app/pages/Themes/Themes.tsx
+++ b/src/app/pages/Themes/Themes.tsx
@@ -1,8 +1,13 @@
import './Themes.scss';
+import { PageRef } from '@/page'
-export default function Themes() {
+type ThemesProps = {
+ themesRef: PageRef;
+}
+
+export default function Themes({themesRef}: ThemesProps) {
return (
-
+
.03 / Themes
{`What are this year's UP-Grade themes?`}
diff --git a/src/app/styles/variables.scss b/src/app/styles/variables.scss
index 9aafbc2..b3eea06 100644
--- a/src/app/styles/variables.scss
+++ b/src/app/styles/variables.scss
@@ -1,6 +1,6 @@
// Colors
$primary-black: #212121;
-$secondary-yellow: #f5ff85;
+$seondary-yellow: #f5ff85;
// Font Families
$p-font: var(--font-aspekta);
From 83177964a4d4a0bd2f24b9b924003e39806fee24 Mon Sep 17 00:00:00 2001
From: Aaron Chan <42254254+aaronchan32@users.noreply.github.com>
Date: Thu, 30 May 2024 02:29:52 -0700
Subject: [PATCH 08/13] fix: fix linting and styling issues and refactor navbar
logic
---
src/app/Home.scss | 1 -
src/app/components/Navbar/Navbar.scss | 14 ++-
src/app/components/Navbar/Navbar.tsx | 104 +++++-------------
.../Navbar/hooks/useHandleAsterisks.ts | 41 +++++++
...{handleToggle.ts => useHandleHamburger.ts} | 21 ++--
.../Navbar/hooks/useHandleScroll.ts | 81 ++++++++++++++
src/app/page.tsx | 22 ++--
src/app/pages/Apply/Apply.tsx | 7 +-
src/app/pages/FAQ/FAQ.tsx | 6 +-
src/app/pages/Landing/Landing.tsx | 6 +-
src/app/pages/Overview/Overview.tsx | 6 +-
src/app/pages/Themes/Themes.tsx | 6 +-
12 files changed, 202 insertions(+), 113 deletions(-)
create mode 100644 src/app/components/Navbar/hooks/useHandleAsterisks.ts
rename src/app/components/Navbar/hooks/{handleToggle.ts => useHandleHamburger.ts} (75%)
create mode 100644 src/app/components/Navbar/hooks/useHandleScroll.ts
diff --git a/src/app/Home.scss b/src/app/Home.scss
index 5390f26..63328ec 100644
--- a/src/app/Home.scss
+++ b/src/app/Home.scss
@@ -31,7 +31,6 @@
}
section {
-
scroll-snap-align: center;
padding-block: $main-padding-mobile-block;
padding-inline: $main-padding-mobile-inline;
diff --git a/src/app/components/Navbar/Navbar.scss b/src/app/components/Navbar/Navbar.scss
index d6dbcc7..60c42a1 100644
--- a/src/app/components/Navbar/Navbar.scss
+++ b/src/app/components/Navbar/Navbar.scss
@@ -1,4 +1,4 @@
-nav {
+nav {
a {
text-decoration: none;
}
@@ -96,7 +96,7 @@ nav {
transition: width 0.3s ease-in;
}
- &:hover:before {
+ &:is(:hover, :focus-visible):before {
width: 100%;
left: 0;
}
@@ -114,11 +114,19 @@ nav {
color: #212121;
opacity: 0.45;
max-width: 310px;
+ height: 1em;
+ // &::before {
+ // content: '********************************************************************************';
+ // display: block;
+ // white-space: nowrap;
+ // width: 100%;
+ // height: 100%;
+ // overflow: hidden;
+ // }
}
.nav-footer {
margin-top: auto;
- //margin-bottom: 86px;
display: flex;
justify-content: center;
flex-direction: column;
diff --git a/src/app/components/Navbar/Navbar.tsx b/src/app/components/Navbar/Navbar.tsx
index 1163b49..9175d9c 100644
--- a/src/app/components/Navbar/Navbar.tsx
+++ b/src/app/components/Navbar/Navbar.tsx
@@ -1,22 +1,23 @@
'use client';
import Link from 'next/link';
import './Navbar.scss';
-import { useState, useEffect, useRef } from 'react';
+import { useState, useRef, RefObject } from 'react';
import Hamburger from './Hamburger/Hamburger';
import FocusTrap from 'focus-trap-react';
-import FAQ from '@/pages/FAQ/FAQ';
-import { handleToggle } from './hooks/handleToggle';
+import { useHandleHamburger } from './hooks/useHandleHamburger';
+import { useHandleAsterisks } from './hooks/useHandleAsterisks';
+import { useHandleScroll } from './hooks/useHandleScroll';
type NavbarProps = {
pageRefs: {
- mainRef: React.RefObject;
- landingRef: React.RefObject;
- overviewRef: React.RefObject;
- themesRef: React.RefObject;
- faqRef: React.RefObject;
- applyRef: React.RefObject;
- }
-}
+ mainRef: RefObject;
+ landingRef: RefObject;
+ overviewRef: RefObject;
+ themesRef: RefObject;
+ faqRef: RefObject;
+ applyRef: RefObject;
+ };
+};
const NAV_LINKS = [
{ href: '#landing', text: 'Home' },
@@ -26,74 +27,21 @@ const NAV_LINKS = [
{ href: '#apply', text: 'Apply' }
];
-const PAGE_TYPES = ["Home", "Overview", "Themes", "FAQ", "Apply"]
-
+const PAGE_TYPES = ['Home', 'Overview', 'Themes', 'FAQ', 'Apply'] as const;
+export type PageType = (typeof PAGE_TYPES)[number];
-export default function Navbar({pageRefs}: NavbarProps) {
- const { mainRef, landingRef, overviewRef, themesRef, faqRef, applyRef } = pageRefs;
- const [numAstericks, setNumAsterisks] = useState(0);
+export default function Navbar({ pageRefs }: NavbarProps) {
const navContainerRef = useRef(null);
const asterisksRef1 = useRef(null);
const asterisksRef2 = useRef(null);
- const [currPage, setCurrPage] = useState('Home');
-
- const {toggleHamburger, isHamburgerOpen, hamburgerInnerRef} = handleToggle({navContainerRef});
-
- useEffect(() => {
- const mainElement = mainRef.current;
- const landingElement = landingRef.current;
- const overviewElement = overviewRef.current;
- const themesElement = themesRef.current;
- const faqElement = faqRef.current;
- const applyElement = applyRef.current;
-
- /**
- * Sets the current page
- * Current page is based on what part of scroll we are at
- */
- if (!mainElement || !landingElement || !overviewElement || !themesElement || !faqElement || !applyElement) return;
+ const [currPage, setCurrPage] = useState('Home');
- const pagesList = [landingElement, overviewElement, themesElement, faqElement, applyElement]
- const handleScroll = () => {
- const scrollPosition = mainElement.scrollTop || 0;
-
- pagesList.forEach((page, index) => {
- const pageTop = page.offsetTop;
- const pageBottom = pageTop + page.clientHeight;
-
- const halfScrollPosition = scrollPosition + window.innerHeight/2;
- if(halfScrollPosition > pageTop && halfScrollPosition < pageBottom){
- setCurrPage(PAGE_TYPES[index]);
- }
- });
- }
+ const { toggleHamburger, isHamburgerOpen, hamburgerInnerRef } =
+ useHandleHamburger({ navContainerRef });
- mainElement.addEventListener("scroll", handleScroll)
- /**
- * Dynamically set the number of astricks
- */
- const updateAsterisks = () => {
- if (asterisksRef1.current) {
- const width = asterisksRef1.current.getBoundingClientRect().width;
- const calcNumAstericks = Math.floor(width / 10);
- setNumAsterisks(calcNumAstericks);
- }
- if (asterisksRef2.current) {
- const width = asterisksRef2.current.getBoundingClientRect().width;
- const calcNumAstericks = Math.floor(width / 10);
- setNumAsterisks(calcNumAstericks);
- }
- };
+ const { numAstericks } = useHandleAsterisks({ asterisksRef1, asterisksRef2 });
-
- updateAsterisks();
- window.addEventListener('resize', updateAsterisks);
-
- return () => {
- window.removeEventListener('resize', updateAsterisks)
- mainElement.removeEventListener('scroll', handleScroll)
- };
- }, []);
+ useHandleScroll({ setCurrPage, pageRefs, PAGE_TYPES });
return (
@@ -133,12 +81,16 @@ export default function Navbar({pageRefs}: NavbarProps) {
}}
>
-
+
{link.text.toUpperCase()}
-
- {`.0${index + 1}`}
-
+ {`.0${index + 1}`}
diff --git a/src/app/components/Navbar/hooks/useHandleAsterisks.ts b/src/app/components/Navbar/hooks/useHandleAsterisks.ts
new file mode 100644
index 0000000..bd4382a
--- /dev/null
+++ b/src/app/components/Navbar/hooks/useHandleAsterisks.ts
@@ -0,0 +1,41 @@
+import { RefObject, useEffect, useState } from 'react';
+
+type UseHandleAsterisksProps = {
+ asterisksRef1: RefObject;
+ asterisksRef2: RefObject;
+};
+
+export const useHandleAsterisks = ({
+ asterisksRef1,
+ asterisksRef2
+}: UseHandleAsterisksProps) => {
+ const [numAstericks, setNumAsterisks] = useState(0);
+
+ // TODO: add animation when asterisk first load in to make it less jarring (stagger effect?)
+ useEffect(() => {
+ /**
+ * Dynamically set the number of astricks
+ */
+ const updateAsterisks = () => {
+ if (asterisksRef1.current) {
+ const width = asterisksRef1.current.getBoundingClientRect().width;
+ const calcNumAstericks = Math.floor(width / 10);
+ setNumAsterisks(calcNumAstericks);
+ }
+ if (asterisksRef2.current) {
+ const width = asterisksRef2.current.getBoundingClientRect().width;
+ const calcNumAstericks = Math.floor(width / 10);
+ setNumAsterisks(calcNumAstericks);
+ }
+ };
+
+ updateAsterisks();
+ window.addEventListener('resize', updateAsterisks);
+
+ return () => {
+ window.removeEventListener('resize', updateAsterisks);
+ };
+ });
+
+ return { numAstericks };
+};
diff --git a/src/app/components/Navbar/hooks/handleToggle.ts b/src/app/components/Navbar/hooks/useHandleHamburger.ts
similarity index 75%
rename from src/app/components/Navbar/hooks/handleToggle.ts
rename to src/app/components/Navbar/hooks/useHandleHamburger.ts
index 43b8f41..6e3e8df 100644
--- a/src/app/components/Navbar/hooks/handleToggle.ts
+++ b/src/app/components/Navbar/hooks/useHandleHamburger.ts
@@ -1,17 +1,18 @@
-import { useState, useRef } from "react";
+import { useState, useRef, RefObject } from 'react';
-type handleToggleProps = {
- navContainerRef: React.RefObject;
-}
+type UseHandleHamburgerProps = {
+ navContainerRef: RefObject;
+};
-export const handleToggle = ({navContainerRef}: handleToggleProps) => {
+export const useHandleHamburger = ({
+ navContainerRef
+}: UseHandleHamburgerProps) => {
const hamburgerInnerRef = useRef(null);
const [isHamburgerOpen, setIsHamburgerOpen] = useState(false);
const toggleHamburger = () => {
- console.log(navContainerRef.current?.classList)
- navContainerRef.current?.classList.toggle("slideTransition")
- console.log(navContainerRef.current?.classList)
+ // Toggle slide transition to account for mobile to desktop resize
+ navContainerRef.current?.classList.toggle('slideTransition');
setIsHamburgerOpen(!isHamburgerOpen);
if (!isHamburgerOpen) {
@@ -40,5 +41,5 @@ export const handleToggle = ({navContainerRef}: handleToggleProps) => {
}
};
- return {toggleHamburger, isHamburgerOpen, hamburgerInnerRef}
-}
\ No newline at end of file
+ return { toggleHamburger, isHamburgerOpen, hamburgerInnerRef };
+};
diff --git a/src/app/components/Navbar/hooks/useHandleScroll.ts b/src/app/components/Navbar/hooks/useHandleScroll.ts
new file mode 100644
index 0000000..8b7d743
--- /dev/null
+++ b/src/app/components/Navbar/hooks/useHandleScroll.ts
@@ -0,0 +1,81 @@
+import { Dispatch, RefObject, SetStateAction, useEffect } from 'react';
+import { PageType } from '../Navbar';
+
+type UseHandleScrollType = {
+ setCurrPage: Dispatch>;
+ pageRefs: {
+ mainRef: RefObject;
+ landingRef: RefObject;
+ overviewRef: RefObject;
+ themesRef: RefObject;
+ faqRef: RefObject;
+ applyRef: RefObject;
+ };
+ PAGE_TYPES: readonly ['Home', 'Overview', 'Themes', 'FAQ', 'Apply'];
+};
+
+export const useHandleScroll = ({
+ setCurrPage,
+ pageRefs,
+ PAGE_TYPES
+}: UseHandleScrollType) => {
+ const { mainRef, landingRef, overviewRef, themesRef, faqRef, applyRef } =
+ pageRefs;
+ useEffect(() => {
+ const mainElement = mainRef.current;
+ const landingElement = landingRef.current;
+ const overviewElement = overviewRef.current;
+ const themesElement = themesRef.current;
+ const faqElement = faqRef.current;
+ const applyElement = applyRef.current;
+
+ /**
+ * Sets the current page
+ * Current page is based on what part of scroll we are at
+ */
+ if (
+ !mainElement ||
+ !landingElement ||
+ !overviewElement ||
+ !themesElement ||
+ !faqElement ||
+ !applyElement
+ )
+ return;
+
+ const pagesList = [
+ landingElement,
+ overviewElement,
+ themesElement,
+ faqElement,
+ applyElement
+ ];
+ const handleScroll = () => {
+ const scrollPosition = mainElement.scrollTop || 0;
+
+ pagesList.forEach((page, index) => {
+ const pageTop = page.offsetTop;
+ const pageBottom = pageTop + page.clientHeight;
+
+ const halfScrollPosition = scrollPosition + window.innerHeight / 2;
+ if (halfScrollPosition > pageTop && halfScrollPosition < pageBottom) {
+ setCurrPage(PAGE_TYPES[index]);
+ }
+ });
+ };
+
+ mainElement.addEventListener('scroll', handleScroll);
+ return () => {
+ mainElement.removeEventListener('scroll', handleScroll);
+ };
+ }, [
+ PAGE_TYPES,
+ applyRef,
+ faqRef,
+ landingRef,
+ mainRef,
+ overviewRef,
+ setCurrPage,
+ themesRef
+ ]);
+};
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 35c1a87..6bf7e1c 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,4 +1,4 @@
-"use client";
+'use client';
import React, { useRef } from 'react';
import './Home.scss';
@@ -10,8 +10,7 @@ import FAQ from './pages/FAQ/FAQ';
import Apply from './pages/Apply/Apply';
import Navbar from './components/Navbar/Navbar';
-export type PageRef = React.RefObject
-
+export type PageRef = React.RefObject;
export default function Home() {
const mainRef = useRef(null);
@@ -23,14 +22,23 @@ export default function Home() {
return (
-
+
-
+
-
+
{/* Footer is inside Apply */}
-
+
);
diff --git a/src/app/pages/Apply/Apply.tsx b/src/app/pages/Apply/Apply.tsx
index a567dfc..3869e1f 100644
--- a/src/app/pages/Apply/Apply.tsx
+++ b/src/app/pages/Apply/Apply.tsx
@@ -1,13 +1,12 @@
import Footer from '@/components/Footer/Footer';
import './Apply.scss';
-import {PageRef} from '@/page'
+import { PageRef } from '@/page';
type ApplyProps = {
applyRef: PageRef;
-}
-
+};
-export default function Apply({applyRef}: ApplyProps) {
+export default function Apply({ applyRef }: ApplyProps) {
return (
.05 / Apply
diff --git a/src/app/pages/FAQ/FAQ.tsx b/src/app/pages/FAQ/FAQ.tsx
index 2207fb9..d2495a4 100644
--- a/src/app/pages/FAQ/FAQ.tsx
+++ b/src/app/pages/FAQ/FAQ.tsx
@@ -1,11 +1,11 @@
import './FAQ.scss';
-import {PageRef} from '@/page'
+import { PageRef } from '@/page';
type FAQProps = {
faqRef: PageRef;
-}
+};
-export default function FAQ({faqRef}: FAQProps) {
+export default function FAQ({ faqRef }: FAQProps) {
return (
.04 / FAQ
diff --git a/src/app/pages/Landing/Landing.tsx b/src/app/pages/Landing/Landing.tsx
index ad05e2f..f2ef29c 100644
--- a/src/app/pages/Landing/Landing.tsx
+++ b/src/app/pages/Landing/Landing.tsx
@@ -1,11 +1,11 @@
import './Landing.scss';
-import { PageRef } from '@/page'
+import { PageRef } from '@/page';
type LandingProps = {
landingRef: PageRef;
-}
+};
-export default function Landing({landingRef} : LandingProps) {
+export default function Landing({ landingRef }: LandingProps) {
return (
.01 / Home
diff --git a/src/app/pages/Overview/Overview.tsx b/src/app/pages/Overview/Overview.tsx
index d986210..695d3ca 100644
--- a/src/app/pages/Overview/Overview.tsx
+++ b/src/app/pages/Overview/Overview.tsx
@@ -1,11 +1,11 @@
import './Overview.scss';
-import {PageRef} from '@/page'
+import { PageRef } from '@/page';
type OverviewProps = {
overviewRef: PageRef;
-}
+};
-export default function Overview({overviewRef} : OverviewProps) {
+export default function Overview({ overviewRef }: OverviewProps) {
return (
.02 / OVERVIEW
diff --git a/src/app/pages/Themes/Themes.tsx b/src/app/pages/Themes/Themes.tsx
index 22cc298..2e96fcc 100644
--- a/src/app/pages/Themes/Themes.tsx
+++ b/src/app/pages/Themes/Themes.tsx
@@ -1,11 +1,11 @@
import './Themes.scss';
-import { PageRef } from '@/page'
+import { PageRef } from '@/page';
type ThemesProps = {
themesRef: PageRef;
-}
+};
-export default function Themes({themesRef}: ThemesProps) {
+export default function Themes({ themesRef }: ThemesProps) {
return (
.03 / Themes
From 6083c430af0d443d7411be5bbdea857cde073075 Mon Sep 17 00:00:00 2001
From: Aaron Chan <42254254+aaronchan32@users.noreply.github.com>
Date: Thu, 30 May 2024 17:00:22 -0700
Subject: [PATCH 09/13] test: remove dynamic navbar asterisks and try css
approach with potential overflow issue
---
src/app/components/Navbar/Navbar.scss | 20 +++++++++----------
src/app/components/Navbar/Navbar.tsx | 3 ++-
.../Navbar/hooks/useHandleAsterisks.ts | 2 +-
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/app/components/Navbar/Navbar.scss b/src/app/components/Navbar/Navbar.scss
index 60c42a1..86531e9 100644
--- a/src/app/components/Navbar/Navbar.scss
+++ b/src/app/components/Navbar/Navbar.scss
@@ -93,7 +93,7 @@ nav {
width: 0;
height: 2px;
background-color: #212121;
- transition: width 0.3s ease-in;
+ transition: width 0.25s;
}
&:is(:hover, :focus-visible):before {
@@ -114,15 +114,14 @@ nav {
color: #212121;
opacity: 0.45;
max-width: 310px;
- height: 1em;
- // &::before {
- // content: '********************************************************************************';
- // display: block;
- // white-space: nowrap;
- // width: 100%;
- // height: 100%;
- // overflow: hidden;
- // }
+ &::before {
+ content: '********************************************************************************';
+ display: block;
+ white-space: nowrap;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ }
}
.nav-footer {
@@ -150,6 +149,7 @@ nav {
background-color: #212121;
height: 61.75px;
margin-bottom: 40px;
+ transition: background-color 0.3s;
}
h1 {
diff --git a/src/app/components/Navbar/Navbar.tsx b/src/app/components/Navbar/Navbar.tsx
index 9175d9c..2df1dae 100644
--- a/src/app/components/Navbar/Navbar.tsx
+++ b/src/app/components/Navbar/Navbar.tsx
@@ -142,7 +142,8 @@ export default function Navbar({ pageRefs }: NavbarProps) {
+
{link.text.toUpperCase()}
-
{' '}
+
- {' '} - .0{links.indexOf(link) + 1}{' '} + {`.0${index + 1}`}
{'*'.repeat(numAstericks)}
@@ -179,23 +166,23 @@ export default function Navbar() {ADD ME TO CART
diff --git a/src/app/components/Navbar/hooks/handleToggle.ts b/src/app/components/Navbar/hooks/handleToggle.ts new file mode 100644 index 0000000..43b8f41 --- /dev/null +++ b/src/app/components/Navbar/hooks/handleToggle.ts @@ -0,0 +1,44 @@ +import { useState, useRef } from "react"; + +type handleToggleProps = { + navContainerRef: React.RefObject.05 / Apply
Why Apply?
diff --git a/src/app/pages/FAQ/FAQ.tsx b/src/app/pages/FAQ/FAQ.tsx index 67cea5f..2207fb9 100644 --- a/src/app/pages/FAQ/FAQ.tsx +++ b/src/app/pages/FAQ/FAQ.tsx @@ -1,8 +1,13 @@ import './FAQ.scss'; +import {PageRef} from '@/page' -export default function FAQ() { +type FAQProps = { + faqRef: PageRef; +} + +export default function FAQ({faqRef}: FAQProps) { return ( -.04 / FAQ
Commonly Asked Questions
.01 / Home
.02 / OVERVIEW
What is UP-Grade?
diff --git a/src/app/pages/Themes/Themes.tsx b/src/app/pages/Themes/Themes.tsx
index 50c4e59..22cc298 100644
--- a/src/app/pages/Themes/Themes.tsx
+++ b/src/app/pages/Themes/Themes.tsx
@@ -1,8 +1,13 @@
import './Themes.scss';
+import { PageRef } from '@/page'
-export default function Themes() {
+type ThemesProps = {
+ themesRef: PageRef;
+}
+
+export default function Themes({themesRef}: ThemesProps) {
return (
- .03 / Themes .05 / Apply .04 / FAQ .01 / Home .02 / OVERVIEW .03 / Themes{`What are this year's UP-Grade themes?`}
+
{link.text.toUpperCase()}
-
- {`.0${index + 1}`}
-
+ {`.0${index + 1}`}