mirror of
https://github.com/Unkn0wnCat/KevinK.dev.js.git
synced 2025-04-30 02:36:56 +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";
|
||||
|
||||
const OffScreenNav = ({ active, close }) => {
|
||||
if (typeof window === "undefined") {
|
||||
return null;
|
||||
}
|
||||
if (typeof document === "undefined") return <></>;
|
||||
|
||||
return createPortal(
|
||||
<div
|
||||
className={
|
||||
styles.offscreenNav + " " + (active ? styles.active : "")
|
||||
styles.offscreenNav + (active ? " " + styles.active : "")
|
||||
}
|
||||
>
|
||||
<div className={styles.inner}>
|
||||
|
@ -53,10 +51,15 @@ const OffScreenNav = ({ active, close }) => {
|
|||
</Link>
|
||||
</div>
|
||||
</div>,
|
||||
window.document.body
|
||||
document.body
|
||||
);
|
||||
};
|
||||
|
||||
OffScreenNav.propTypes = {
|
||||
close: PropTypes.func.isRequired,
|
||||
active: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
const Navigation = ({ isHome }) => {
|
||||
let [atTop, setAtTop] = useState(false);
|
||||
const [offscreenNavActive, setOffscreenNavActive] = useState(false);
|
||||
|
|
Loading…
Add table
Reference in a new issue