From 25aef3afdf6627a1b5cdead2fd052bd8dff2224f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lima?= Date: Fri, 7 Mar 2025 04:38:57 +0000 Subject: [PATCH] Added new pages and nav with menu --- src/components/Sidebar.tsx | 128 ++++++++++++++++++++++++------ src/pages/training/grammar.tsx | 41 ++++++++++ src/pages/training/vocabulary.tsx | 41 ++++++++++ 3 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 src/pages/training/grammar.tsx create mode 100644 src/pages/training/vocabulary.tsx diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index d551f7a3..8e685c7b 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -12,6 +12,10 @@ import { BsCurrencyDollar, BsClipboardData, BsPeople, + BsChevronDown, + BsChevronUp, + BsChatText, + BsCardText, } from "react-icons/bs"; import { GoWorkflow } from "react-icons/go"; import { CiDumbbell } from "react-icons/ci"; @@ -31,7 +35,7 @@ import { useAllowedEntities, useAllowedEntitiesSomePermissions, } from "@/hooks/useEntityPermissions"; -import { useMemo } from "react"; +import { useMemo, useState } from "react"; import { PermissionType } from "../interfaces/permissions"; interface Props { @@ -52,6 +56,7 @@ interface NavProps { disabled?: boolean; isMinimized?: boolean; badge?: number; + children?: React.ReactNode; } const Nav = ({ @@ -62,34 +67,71 @@ const Nav = ({ disabled = false, isMinimized = false, badge, + children, }: NavProps) => { + const [open, setOpen] = useState(false); return ( - - - {!isMinimized && {label}} - {!!badge && badge > 0 && ( -
- {badge} -
- )} - + + + {!isMinimized && {label}} + {!!badge && badge > 0 && ( +
+ {badge} +
+ )} + {children && ( + + )} + + {open || isMinimized ? children : null} + ); }; @@ -325,7 +367,24 @@ export default function Sidebar({ path={path} keyPath="/training" isMinimized={isMinimized} - /> + > +