|
1 |
| -import { Outlet, Link, useLocation, useParams } from "react-router-dom"; |
2 |
| -import { SVGReactElement } from "../../types/common"; |
3 |
| -import { LINK_URL } from "../../constants/path"; |
4 |
| -import Landing from "../../assets/icons/landing.svg?react"; |
5 |
| -import ChevronRight from "../../assets/icons/chevron-right.svg?react"; |
6 |
| -import Backlog from "../../assets/icons/backlog.svg?react"; |
7 |
| -import Sprint from "../../assets/icons/sprint.svg?react"; |
8 |
| -import Setting from "../../assets/icons/settings.svg?react"; |
9 |
| - |
10 |
| -interface PageIconProps { |
11 |
| - Icon: SVGReactElement; |
12 |
| - activated: boolean; |
13 |
| - to: string; |
14 |
| - pageName: string; |
15 |
| -} |
16 |
| - |
17 |
| -const PageIcon = ({ Icon, activated, to, pageName }: PageIconProps): JSX.Element => { |
18 |
| - if (activated) { |
19 |
| - return ( |
20 |
| - <div className="flex justify-between items-center pl-2 pr-[0.3125rem] py-[0.3125rem] rounded-full cursor-pointer bg-white text-middle-green transition-all w-fit hover:min-w-40 hover:shadow-box hover:gap-2 group"> |
21 |
| - <Icon width={24} height={24} fill="#3A5624" className="shrink-0" /> |
22 |
| - <p className="text-base font-bold shrink-0 select-none hidden group-hover:inline-flex"> |
23 |
| - {pageName} |
24 |
| - </p> |
25 |
| - <ChevronRight width={18} height={18} stroke="#3A5624" className="shrink-0" /> |
26 |
| - </div> |
27 |
| - ); |
28 |
| - } |
29 |
| - |
30 |
| - return ( |
31 |
| - <Link |
32 |
| - to={to} |
33 |
| - className="group flex justify-center items-center w-[3.4375rem] text-white py-[0.3125rem] transition-all rounded-full cursor-pointer hover:min-w-40 hover:shadow-box hover:gap-2 hover:bg-white hover:text-middle-green hover:pl-2 hover:pr-[0.3125rem] hover:justify-between" |
34 |
| - > |
35 |
| - <Icon |
36 |
| - width={24} |
37 |
| - height={24} |
38 |
| - fill="#FFFFFF" |
39 |
| - className="shrink-0 group-hover:fill-middle-green" |
40 |
| - /> |
41 |
| - <p className="text-base font-bold shrink-0 select-none hidden group-hover:inline-flex"> |
42 |
| - {pageName} |
43 |
| - </p> |
44 |
| - <ChevronRight |
45 |
| - width={18} |
46 |
| - height={18} |
47 |
| - stroke="#3A5624" |
48 |
| - className="shrink-0 hidden group-hover:inline-flex" |
49 |
| - /> |
50 |
| - </Link> |
51 |
| - ); |
52 |
| -}; |
| 1 | +import { Outlet, useLocation, useParams } from "react-router-dom"; |
| 2 | +import ProjectSidebar from "../../components/main/ProjectSidebar"; |
53 | 3 |
|
54 | 4 | const MainPage = () => {
|
55 | 5 | const { pathname } = useLocation();
|
56 | 6 | const { projectId } = useParams();
|
57 | 7 | if (!projectId) throw Error("잘못된 ProjectID 입니다.");
|
58 | 8 | return (
|
59 | 9 | <div className="flex justify-center items-center h-screen min-w-[76rem] gap-9">
|
60 |
| - <div className="flex flex-col justify-between h-[40.5rem] bg-gradient-to-t from-sidebar-linear-from to-sidebar-linear-to rounded-lg shadow-box z-10"> |
61 |
| - <div className="flex flex-col pl-[0.9375rem] pt-[1.5625rem] w-[5.3125rem] gap-5 text-white"> |
62 |
| - <PageIcon |
63 |
| - Icon={Landing} |
64 |
| - activated={pathname === LINK_URL.MAIN(projectId)} |
65 |
| - to={LINK_URL.MAIN(projectId)} |
66 |
| - pageName="메인페이지" |
67 |
| - /> |
68 |
| - <PageIcon |
69 |
| - Icon={Backlog} |
70 |
| - activated={pathname === LINK_URL.BACKLOG(projectId)} |
71 |
| - to={LINK_URL.BACKLOG(projectId)} |
72 |
| - pageName="백로그" |
73 |
| - /> |
74 |
| - <PageIcon |
75 |
| - Icon={Sprint} |
76 |
| - activated={pathname === LINK_URL.SPRINT(projectId)} |
77 |
| - to={LINK_URL.SPRINT(projectId)} |
78 |
| - pageName="스프린트" |
79 |
| - /> |
80 |
| - <PageIcon |
81 |
| - Icon={Setting} |
82 |
| - activated={pathname === LINK_URL.SETTINGS(projectId)} |
83 |
| - to={LINK_URL.SETTINGS(projectId)} |
84 |
| - pageName="프로젝트 설정" |
85 |
| - /> |
86 |
| - </div> |
87 |
| - <div className="w-[5.3125rem]"></div> |
88 |
| - </div> |
| 10 | + <ProjectSidebar {...{ pathname, projectId }} /> |
89 | 11 | <div className="h-[40.5rem] min-w-[67.9375rem] border-2">
|
90 | 12 | <Outlet />
|
91 | 13 | </div>
|
|
0 commit comments