From 9eb0080d13e785d9be29e0393e1477c68f5f6bce Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sat, 23 Nov 2024 18:34:53 +0300 Subject: [PATCH] feat: add sideBar active(#36) --- src/components/Sidebar/Sidebar.tsx | 85 ++++++++++++++++-------------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index 4ae207a..23bda45 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -1,46 +1,51 @@ -import { Box, Button, Heading, VStack } from '@chakra-ui/react'; +import { Box, Button, Heading, VStack, Divider } from '@chakra-ui/react'; import React from 'react'; -import { Divider } from '@chakra-ui/react'; +import { useLocation, Link } from 'react-router-dom'; import i18next from 'i18next'; -import { Link } from 'react-router-dom'; -const Sidebar = () => ( - - - {i18next.t(`dry-wash.arm.master.sideBar.title`)} - +const Sidebar = () => { + const location = useLocation(); - - - - - - - - -); + const isActive = (keyword: string) => location.pathname.includes(keyword); + + return ( + + + {i18next.t(`dry-wash.arm.master.sideBar.title`)} + + + + + + + + + + + ); +}; export default Sidebar;