nav menu wave
This commit is contained in:
30
src/nav/Menu.tsx
Normal file
30
src/nav/Menu.tsx
Normal file
@@ -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 (
|
||||
<motion.section className="menu">
|
||||
{
|
||||
articles.map(title => <div>
|
||||
{title}
|
||||
</div>)
|
||||
}
|
||||
</motion.section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user