mirror of
https://github.com/Unkn0wnCat/KevinK.dev.js.git
synced 2025-04-30 10:46:57 +02:00
Fix navigation
This commit is contained in:
parent
b1eb8b4221
commit
4b0487e300
1 changed files with 8 additions and 5 deletions
|
@ -10,14 +10,12 @@ import { X } from "lucide-react";
|
||||||
import { Fade as Hamburger } from "hamburger-react";
|
import { Fade as Hamburger } from "hamburger-react";
|
||||||
|
|
||||||
const OffScreenNav = ({ active, close }) => {
|
const OffScreenNav = ({ active, close }) => {
|
||||||
if (typeof window === "undefined") {
|
if (typeof document === "undefined") return <></>;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
styles.offscreenNav + " " + (active ? styles.active : "")
|
styles.offscreenNav + (active ? " " + styles.active : "")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className={styles.inner}>
|
<div className={styles.inner}>
|
||||||
|
@ -53,10 +51,15 @@ const OffScreenNav = ({ active, close }) => {
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
window.document.body
|
document.body
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OffScreenNav.propTypes = {
|
||||||
|
close: PropTypes.func.isRequired,
|
||||||
|
active: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
const Navigation = ({ isHome }) => {
|
const Navigation = ({ isHome }) => {
|
||||||
let [atTop, setAtTop] = useState(false);
|
let [atTop, setAtTop] = useState(false);
|
||||||
const [offscreenNavActive, setOffscreenNavActive] = useState(false);
|
const [offscreenNavActive, setOffscreenNavActive] = useState(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue