-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { NavLink, useParams } from 'react-router-dom'; | ||
|
||
type ListSettingProps = { | ||
navList: { | ||
label: string; | ||
route: string; | ||
}[]; | ||
}; | ||
|
||
export default function ListSetting({ navList }: ListSettingProps) { | ||
const { teamId } = useParams(); | ||
return ( | ||
<ul className="grow overflow-auto"> | ||
{navList.map((item) => { | ||
const routePath = item.route.includes(':teamId') ? item.route.replace(':teamId', teamId!) : item.route; | ||
|
||
return ( | ||
<li key={item.label} className="relative cursor-pointer border-b bg-white hover:brightness-90"> | ||
<NavLink | ||
to={`/setting/${routePath}`} | ||
className={({ isActive }) => | ||
`flex h-30 flex-col justify-center border-l-4 px-10 ${isActive ? 'border-l-main' : 'border-l-transparent'}` | ||
} | ||
> | ||
<span>{item.label}</span> | ||
</NavLink> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,49 @@ | ||
import { Outlet } from 'react-router-dom'; | ||
import { Outlet, useLocation } from 'react-router-dom'; | ||
import ListSidebar from '@components/sidebar/ListSidebar'; | ||
import { USER_INFO_DUMMY } from '@mocks/mockData'; | ||
import ListSetting from '@/components/sidebar/ListSetting'; | ||
|
||
const navList = [ | ||
{ | ||
label: '개인정보 변경', | ||
route: 'user', | ||
}, | ||
{ | ||
label: '비밀번호 변경', | ||
route: 'password', | ||
}, | ||
{ | ||
label: 'My Teams', | ||
route: 'team/:teamId', | ||
}, | ||
]; | ||
|
||
export default function SettingLayout() { | ||
const location = useLocation(); | ||
|
||
const getTitle = () => { | ||
const currentPath = location.pathname.split('/').slice(-1)[0]; | ||
const currentNavItem = navList.find((item) => | ||
item.route.includes(':teamId') && location.pathname.includes('team') ? 'My Teams' : item.route === currentPath, | ||
); | ||
return currentNavItem ? currentNavItem.label : '이메일 인증'; | ||
}; | ||
|
||
return ( | ||
<> | ||
<h3>Setting Layout</h3> | ||
<Outlet /> | ||
</> | ||
<section className="flex h-full p-15"> | ||
<ListSidebar title={`${USER_INFO_DUMMY.nickname} 님의 정보`}> | ||
<ListSetting navList={navList} /> | ||
</ListSidebar> | ||
<section className="flex w-2/3 flex-col border border-list bg-contents-box"> | ||
<header className="flex h-30 items-center justify-between border-b p-10"> | ||
<div> | ||
<small className="mr-5 font-bold text-category">{getTitle()}</small> | ||
</div> | ||
</header> | ||
<div className="flex grow flex-col overflow-auto p-10 pt-0"> | ||
<Outlet /> | ||
</div> | ||
</section> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,15 @@ export const USER_DUMMY = [ | |
}, | ||
]; | ||
|
||
export const USER_INFO_DUMMY = { | ||
userId: 1, | ||
email: '[email protected]', | ||
nickname: 'momoco', | ||
image: '', | ||
bio: "Hi, I'm Momoco!", | ||
link: ['[email protected]'], | ||
}; | ||
|
||
export const TEAM_DUMMY: Team[] = [ | ||
{ | ||
teamId: 1, | ||
|