From 388d14871b4621adaec68c8ef62dc09602fd16d1 Mon Sep 17 00:00:00 2001 From: * Date: Fri, 5 Jan 2024 19:06:26 +0700 Subject: [PATCH] Continous Refactory --- src/components/Header.js | 94 ++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 56 deletions(-) diff --git a/src/components/Header.js b/src/components/Header.js index af781410..a8b90ebc 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -3,70 +3,52 @@ import { Link, NavLink } from 'react-router-dom'; import menu from './../data/menu'; -function Dropdown() { - const [open, setOpen] = useState(false); - const handleOpen = () => setOpen(!open); - - return ( - <> - { - menu.map(m => ( -
  • - { !m.children ? ( - - {m.name} - ) : ( - <> - - {m.name} - { !open ? - () - : - () - } - - - {open ? () : <>} - - )} -
  • - )) - } - - ) -} - function Navbar() { const [toggle, setToggle] = useState(false); const handleToggle = () => setToggle(!toggle); + const [dropdown, setDropdown] = useState(false); + const handleDropdown = () => setDropdown(!dropdown); return (