diff --git a/src/img/menu-wave.svg b/src/img/menu-wave.svg new file mode 100644 index 0000000..4d18483 --- /dev/null +++ b/src/img/menu-wave.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/nav/Menu.tsx b/src/nav/Menu.tsx new file mode 100644 index 0000000..e591357 --- /dev/null +++ b/src/nav/Menu.tsx @@ -0,0 +1,30 @@ +import "./menu.scss"; +import {motion, animate} from "framer-motion"; +import {useEffect} from "react"; + +const articles = [ + "Test 123", + "Hello", + "Title of Album" +]; +const hidden = -999; + +export function Menu({active} : {active: boolean}) { + useEffect(() => { + if(active) { + animate(".menu", {left : 0}) + } else { + animate(".menu", {left : hidden}) + } + }, [active]); + + return ( + + { + articles.map(title =>
+ {title} +
) + } +
+ ) +} \ No newline at end of file diff --git a/src/nav/Nav.tsx b/src/nav/Nav.tsx new file mode 100644 index 0000000..425dd7a --- /dev/null +++ b/src/nav/Nav.tsx @@ -0,0 +1,42 @@ +import React, {useState} from "react"; +import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; +import {faBars} from "@fortawesome/free-solid-svg-icons/faBars"; +import {Menu} from "./Menu"; +import wave from "../img/menu-wave.svg"; +import "./nav.scss"; +import {motion} from "framer-motion"; + +export function Nav() { + const [active, setActive] = useState(false); + + return <> +