Skip to content

Commit 0ef7e22

Browse files
authored
Feat(Client): 관심직무 페이지 라우팅 및 사이드바 추가 (#254)
* feat: 관심 직무 핀 페이지 및 라우팅 추가 * feat: 사이드바에 '관심 직무 핀' 메뉴 추가 및 라우팅 개선 * feat: '관심 직무 핀' 아이콘 추가 및 사이드바에 적용
1 parent c8a4ff8 commit 0ef7e22

File tree

11 files changed

+54
-9
lines changed

11 files changed

+54
-9
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const JobPins = () => {
2+
return <div>관심 직무 핀 페이지</div>;
3+
};
4+
5+
export default JobPins;

apps/client/src/routes/router.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Category from '@pages/category/Category';
2+
import JobPins from '@pages/jobPins/JobPins';
23
import Level from '@pages/level/Level';
34
import Login from '@pages/login/Login';
45
import MyBookmark from '@pages/myBookmark/MyBookmark';
@@ -52,6 +53,10 @@ export const router = createBrowserRouter([
5253
path: ROUTES_CONFIG.termsOfService.path,
5354
element: <TermsOfService />,
5455
},
56+
{
57+
path: ROUTES_CONFIG.jobPins.path,
58+
element: <JobPins />,
59+
},
5560
],
5661
},
5762
]);

apps/client/src/routes/routesConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ export const ROUTES_CONFIG = {
3535
title: '이용약관',
3636
path: '/terms',
3737
},
38+
jobPins: {
39+
title: '관심 직무 핀',
40+
path: '/job-pins',
41+
},
3842
};

apps/client/src/shared/components/sidebar/SideItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { IconToken } from './types/IconTokenType';
55
const ICON_MAP: Record<IconToken, { on: IconName; off: IconName }> = {
66
clock: { on: 'ic_clock_active', off: 'ic_clock_disable' },
77
bookmark: { on: 'ic_bookmark_active', off: 'ic_bookmark_disable' },
8+
pin: { on: 'ic_pin_active', off: 'ic_pin_disable' },
89
} as const;
910

1011
interface SideItemProps {

apps/client/src/shared/components/sidebar/Sidebar.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function Sidebar() {
5454
goBookmarks,
5555
selectCategory,
5656
goLevel,
57+
goJobPins,
5758
setSelectedCategoryId,
5859
setActiveTab,
5960
} = useSidebarNav();
@@ -164,6 +165,15 @@ export function Sidebar() {
164165

165166
{/* 메뉴 영역 */}
166167
<div className="flex-1 overflow-y-auto">
168+
<SideItem
169+
icon="pin"
170+
label="관심 직무 핀"
171+
active={activeTab === 'job-pins'}
172+
onClick={() => {
173+
closeMenu();
174+
goJobPins();
175+
}}
176+
/>
167177
<SideItem
168178
icon="clock"
169179
label="리마인드"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type IconToken = 'clock' | 'bookmark';
1+
export type IconToken = 'clock' | 'bookmark' | 'pin';

apps/client/src/shared/hooks/useSidebarNav.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { useNavigate, useLocation, useSearchParams } from 'react-router-dom';
22
import { useCallback, useEffect, useState } from 'react';
3+
import { ROUTES_CONFIG } from '@routes/routesConfig';
34

4-
export type SidebarTab = 'mybookmark' | 'remind' | 'level';
5+
export type SidebarTab = 'mybookmark' | 'remind' | 'level' | 'job-pins';
56

67
export function useSidebarNav() {
78
const navigate = useNavigate();
@@ -16,7 +17,7 @@ export function useSidebarNav() {
1617
useEffect(() => {
1718
const path = location.pathname;
1819

19-
if (path.startsWith('/my-bookmarks')) {
20+
if (path.startsWith(ROUTES_CONFIG.myBookmarks.path)) {
2021
setActiveTab('mybookmark');
2122

2223
const id = searchParams.get('id');
@@ -25,40 +26,52 @@ export function useSidebarNav() {
2526
} else {
2627
setSelectedCategoryId(null);
2728
}
28-
} else if (path === '/' || path.startsWith('/remind')) {
29+
} else if (
30+
path === ROUTES_CONFIG.remind.path ||
31+
path.startsWith('/remind')
32+
) {
2933
setActiveTab('remind');
3034
setSelectedCategoryId(null);
31-
} else if (path.startsWith('/level')) {
35+
} else if (path.startsWith(ROUTES_CONFIG.level.path)) {
3236
setActiveTab('level');
3337
setSelectedCategoryId(null);
38+
} else if (path.startsWith(ROUTES_CONFIG.jobPins.path)) {
39+
setActiveTab('job-pins');
40+
setSelectedCategoryId(null);
3441
}
3542
}, [location.pathname, searchParams]);
3643

3744
const goRemind = useCallback(() => {
3845
setActiveTab('remind');
3946
setSelectedCategoryId(null);
40-
navigate('/');
47+
navigate(ROUTES_CONFIG.remind.path);
4148
}, [navigate]);
4249

4350
const goBookmarks = useCallback(() => {
4451
setActiveTab('mybookmark');
4552
setSelectedCategoryId(null);
46-
navigate('/my-bookmarks');
53+
navigate(ROUTES_CONFIG.myBookmarks.path);
4754
}, [navigate]);
4855

4956
const selectCategory = useCallback(
5057
(id: number, name: string) => {
5158
setActiveTab('mybookmark');
5259
setSelectedCategoryId(id);
53-
navigate(`/my-bookmarks?id=${id}&category=${name}`);
60+
navigate(`${ROUTES_CONFIG.myBookmarks.path}?id=${id}&category=${name}`);
5461
},
5562
[navigate]
5663
);
5764

5865
const goLevel = useCallback(() => {
5966
setActiveTab('level');
6067
setSelectedCategoryId(null);
61-
navigate('/level');
68+
navigate(ROUTES_CONFIG.level.path);
69+
}, [navigate]);
70+
71+
const goJobPins = useCallback(() => {
72+
setActiveTab('job-pins');
73+
setSelectedCategoryId(null);
74+
navigate(ROUTES_CONFIG.jobPins.path);
6275
}, [navigate]);
6376

6477
return {
@@ -68,6 +81,7 @@ export function useSidebarNav() {
6881
goBookmarks,
6982
selectCategory,
7083
goLevel,
84+
goJobPins,
7185
setSelectedCategoryId,
7286
setActiveTab,
7387
};

packages/design-system/src/icons/iconNames.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const iconNames = [
1818
'ic_details_disable',
1919
'ic_extension',
2020
'ic_info',
21+
'ic_pin',
22+
'ic_pin_active',
23+
'ic_pin_disable',
2124
'ic_plus',
2225
'instagram',
2326
'logo',
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)