mirror of
https://github.com/Unkn0wnCat/KevinK.dev.js.git
synced 2025-06-19 02:52:01 +02:00
Fix navigation
This commit is contained in:
parent
4b0487e300
commit
fb16ded074
6 changed files with 84 additions and 58 deletions
61
src/components/offscreenNav.js
Normal file
61
src/components/offscreenNav.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* eslint-disable no-undef */
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Trans, Link } from "gatsby-plugin-react-i18next";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
import * as styles from "./navigation.module.scss";
|
||||
import { X } from "lucide-react";
|
||||
|
||||
const OffScreenNav = ({ active, close }) => {
|
||||
if (typeof document === "undefined") return <></>;
|
||||
|
||||
return createPortal(
|
||||
<div
|
||||
className={
|
||||
styles.offscreenNav + (active ? " " + styles.active : "")
|
||||
}
|
||||
>
|
||||
<div className={styles.inner}>
|
||||
<button className={styles.close} onClick={close}>
|
||||
<X />
|
||||
</button>
|
||||
<span>
|
||||
<Trans>menu</Trans>
|
||||
</span>
|
||||
<Link to="/" activeClassName={styles.active}>
|
||||
<Trans>home</Trans>
|
||||
</Link>
|
||||
<Link
|
||||
id="navBtnProjects"
|
||||
to="/about"
|
||||
activeClassName={styles.active}
|
||||
>
|
||||
<Trans>about</Trans>
|
||||
</Link>
|
||||
<Link
|
||||
id="navBtnProjects"
|
||||
to="/projects"
|
||||
activeClassName={styles.active}
|
||||
>
|
||||
<Trans>projects</Trans>
|
||||
</Link>
|
||||
<Link
|
||||
id="navBtnSocial"
|
||||
to="/social"
|
||||
activeClassName={styles.active}
|
||||
>
|
||||
<Trans>social</Trans>
|
||||
</Link>
|
||||
</div>
|
||||
</div>,
|
||||
document.getElementById("osnav")
|
||||
);
|
||||
};
|
||||
|
||||
OffScreenNav.propTypes = {
|
||||
close: PropTypes.func.isRequired,
|
||||
active: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
export default OffScreenNav;
|
Loading…
Add table
Add a link
Reference in a new issue