From 922b152dd9adc927e19d34a79f26707ba84c30d0 Mon Sep 17 00:00:00 2001 From: William Tran Date: Mon, 13 Sep 2021 20:27:32 -0400 Subject: [PATCH] Revert "Make organized content burger always visible" This reverts commit 0dca9faeba8084897f93e7e986f55446efeeb34e. --- components/OrganizedContent.module.css | 6 +++ components/OrganizedContent.tsx | 68 +++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/components/OrganizedContent.module.css b/components/OrganizedContent.module.css index c5107ad9..00113c82 100644 --- a/components/OrganizedContent.module.css +++ b/components/OrganizedContent.module.css @@ -146,9 +146,15 @@ z-index: 9; background: var(--primary-accent-light); border-radius: calc(5rem / 16); + transition: transform 0.3s ease-in-out; + transform: translateY(calc(94rem / 16)); padding: calc(11rem / 16) calc(9rem / 16); } + .burgerVisible { + transform: translateY(0); + } + .burger > svg { width: 100%; height: 100%; diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index d9385c50..a119b972 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -5,6 +5,7 @@ import React, { useState, useRef, useEffect, + useCallback, } from "react"; import styles from "./OrganizedContent.module.css"; @@ -48,6 +49,8 @@ export function OrganizedContent({ const section = sections[currentIndex]; const isReadAll = section.id === READ_ALL_ID; const ref = useRef(null); + const isVisible = useOnScreen(ref.current); + const burgerVisible = useBurger(isVisible); useEffect(() => { mobileNavOpen @@ -96,7 +99,9 @@ export function OrganizedContent({ )}