Skip to content

Commit

Permalink
Hero: lines should be visible through the header
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluesmile82 committed Oct 28, 2024
1 parent e829789 commit d4a7cae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useState, useEffect, useRef } from "react";
export default function Header() {
const [, setOpenedMenu] = useRecoilState(menuAtom);
const [isVisible, setIsVisible] = useState(true);
const [isAtTop, setIsAtTop] = useState(true);
const lastScrollY = useRef(0);

const handleScroll = () => {
Expand All @@ -24,7 +25,7 @@ export default function Header() {
// Scrolling up
setIsVisible(true);
}

setIsAtTop(currentScrollY === 0);
lastScrollY.current = currentScrollY;
};

Expand All @@ -51,10 +52,12 @@ export default function Header() {
);

return (
<header className={cn("fixed inset-0 w-full h-[90px] py-6 flex z-40 transition-transform duration-500 bg-blue-900",
<header className={cn("fixed inset-0 w-full h-[90px] py-6 flex z-40 transition-transform duration-500",
{
"translate-y-0": isVisible,
"-translate-y-full": !isVisible
"-translate-y-full": !isVisible,
"bg-blue-900": !isAtTop,
"bg-transparent": isAtTop
})
}>
<div className="container flex justify-between items-center">
Expand Down

0 comments on commit d4a7cae

Please sign in to comment.