From 78c3cb49b9d222c21ea39a1348a53804f89b0a69 Mon Sep 17 00:00:00 2001 From: Chunxian Zhang <1836891291@qq.com> Date: Tue, 26 Jul 2022 01:29:53 +0800 Subject: [PATCH] =?UTF-8?q?fe-28=20=E7=BD=91=E9=A1=B5=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lazy-timer-fe/src/components/Sidebar.jsx | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lazy-timer-fe/src/components/Sidebar.jsx diff --git a/lazy-timer-fe/src/components/Sidebar.jsx b/lazy-timer-fe/src/components/Sidebar.jsx new file mode 100644 index 0000000..6817233 --- /dev/null +++ b/lazy-timer-fe/src/components/Sidebar.jsx @@ -0,0 +1,70 @@ +import React from 'react'; +import { Link, NavLink } from 'react-router-dom'; +import { SiShopware } from 'react-icons/si'; +import { MdOutlineCancel } from 'react-icons/md'; +import { TooltipComponent } from '@syncfusion/ej2-react-popups'; + +import { links } from '../data/dummy'; +import { useStateContext } from '../contexts/ContextProvider'; + +const Sidebar = () => { + const { currentColor, activeMenu, setActiveMenu, screenSize } = useStateContext(); + + const handleCloseSideBar = () => { + if (activeMenu !== undefined && screenSize <= 900) { + setActiveMenu(false); + } + }; + + const activeLink = 'flex items-center gap-5 pl-4 pt-3 pb-2.5 rounded-lg text-white text-md m-2'; + const normalLink = 'flex items-center gap-5 pl-4 pt-3 pb-2.5 rounded-lg text-md text-gray-700 dark:text-gray-200 dark:hover:text-black hover:bg-light-gray m-2'; + + return ( +
+ {activeMenu && ( + <> +
+ + Shoppy + + + + +
+
+ {links.map((item) => ( +
+

+ {item.title} +

+ {item.links.map((link) => ( + ({ + backgroundColor: isActive ? currentColor : '', + })} + className={({ isActive }) => (isActive ? activeLink : normalLink)} + > + {link.icon} + {link.name} + + ))} +
+ ))} +
+ + )} +
+ ); +}; + +export default Sidebar;