mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-02-04 01:32:54 +08:00
chore: remove navbar sticky
This commit is contained in:
parent
48eb47b852
commit
0f804c5d09
@ -7,17 +7,8 @@ import useUser from "src/store/useUser";
|
|||||||
import { JSONCrackLogo } from "../JsonCrackLogo";
|
import { JSONCrackLogo } from "../JsonCrackLogo";
|
||||||
|
|
||||||
const StyledNavbarWrapper = styled.div`
|
const StyledNavbarWrapper = styled.div`
|
||||||
position: sticky;
|
|
||||||
top: -1px;
|
|
||||||
left: 0;
|
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
transition: background 0.2s ease-in-out;
|
transition: background 0.2s ease-in-out;
|
||||||
|
|
||||||
&.is-pinned {
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
border-bottom: 1px solid gray;
|
|
||||||
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledNavbar = styled.nav`
|
const StyledNavbar = styled.nav`
|
||||||
@ -61,18 +52,6 @@ export const Navbar = () => {
|
|||||||
const premium = useUser(state => state.premium);
|
const premium = useUser(state => state.premium);
|
||||||
const [opened, { toggle }] = useDisclosure();
|
const [opened, { toggle }] = useDisclosure();
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
const el = document.querySelector(".navbar");
|
|
||||||
const observer = new IntersectionObserver(
|
|
||||||
([e]) => e.target.classList.toggle("is-pinned", e.intersectionRatio < 1),
|
|
||||||
{ threshold: [1] }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (el) observer.observe(el);
|
|
||||||
|
|
||||||
return () => observer.disconnect();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledNavbarWrapper className="navbar">
|
<StyledNavbarWrapper className="navbar">
|
||||||
<StyledNavbar>
|
<StyledNavbar>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user