Skip to content

Commit

Permalink
feat: create navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
FarhanRafid97 committed Aug 25, 2023
1 parent d7c26ca commit 2562ec3
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/components/modules/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
import { Gamepad2 } from 'lucide-react';
import { useEffect, useState } from 'react';
const Navbar = () => {
return <div className="fixed z-[99] px-[] w-full py-4 bg-transparent h-[400px] "></div>;
const [backgroundNavbar, setBackgroundNavbar] = useState('bg-transparent');
useEffect(() => {
const handleScroll = () => {
if (window.scrollY >= 100) {
setBackgroundNavbar('bg-black/30');
} else {
setBackgroundNavbar('bg-transparent');
}
};

window.addEventListener('scroll', handleScroll);

return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []);

return (
<div
className={`fixed z-[99] w-full px-[50px] py-4 bg-transparent animation-background duration-1000 ${backgroundNavbar}`}
>
<div className="text-secondary flex items-center gap-1">
<Gamepad2 className=" text-xl" />
<span className="cool-text text-xl">F</span>
</div>
</div>
);
};

export default Navbar;

0 comments on commit 2562ec3

Please sign in to comment.