diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 96515da9..38b61610 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -27,7 +27,8 @@ function App() { } /> } /> } /> - } /> + } /> + } /> } /> } /> } /> diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx index ab375130..9490daab 100644 --- a/frontend/src/components/Sidebar.jsx +++ b/frontend/src/components/Sidebar.jsx @@ -1,7 +1,29 @@ -import { NavLink } from 'react-router-dom'; +import { NavLink, useNavigate, useLocation } from 'react-router-dom'; import styles from './Sidebar.module.css'; +import { useState } from 'react'; const Sidebar = ({ isOpen, isRoot }) => { + const navigate = useNavigate(); + const location = useLocation(); + + const boardList = [ + { name: '전체 게시판', path: '/board' }, + { name: '증권1팀 게시판', path: '/board/securities-1' }, + { name: '증권2팀 게시판', path: '/board/securities-2' }, + { name: '증권3팀 게시판', path: '/board/securities-3' }, + { name: '자산운용팀 게시판', path: '/board/asset-management' }, + { name: '금융IT팀 게시판', path: '/board/finance-it' }, + { name: '매크로팀 게시판', path: '/board/macro' }, + { name: '트레이딩팀 게시판', path: '/board/trading' }, + ]; + + const currentBoard = boardList.find( + (item) => item.path === location.pathname + ); + const [selectedBoard, setSelectedBoard] = useState( + currentBoard?.name || '전체 게시판' + ); + return (
{/* 클릭 시 사이드바 슬라이드 */} @@ -14,28 +36,27 @@ const Sidebar = ({ isOpen, isRoot }) => {