-
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.
* style: 누락된 theme 컬러 값 추가 * feat: BottomNavigationItem 컴포넌트 작성 * feat: BottomNavigation 컴포너트 작성 * feat: BottomNavigation 스토리북 작성 * fix: 스토리북 docs에 컴포넌트가 올바르게 표시되지 않던 문제 해결 * refactor: NavigationItem 컴포넌트 코드이동 및 삭제 * refactor: icon 크기 정의 방법을 수정 * refactor: getIconColorClasses()를 조건반환문 으로 변경 * chore: iconColor 상수를 컴포넌트 바깥으로 이동
- Loading branch information
Showing
3 changed files
with
135 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import BottomNavigation from '@/ui/Base/BottomNavigation'; | ||
|
||
const meta: Meta<typeof BottomNavigation> = { | ||
title: 'Base/BottomNavigation', | ||
component: BottomNavigation, | ||
tags: ['autodocs'], | ||
parameters: { | ||
docs: { | ||
story: { | ||
inline: false, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof BottomNavigation>; | ||
|
||
export const Default: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
pathname: '/bookarchive', | ||
}, | ||
}, | ||
}, | ||
render: () => { | ||
return <BottomNavigation />; | ||
}, | ||
}; | ||
|
||
export const Search: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
pathname: '/book/search', | ||
}, | ||
}, | ||
}, | ||
render: () => { | ||
return <BottomNavigation />; | ||
}, | ||
}; | ||
|
||
export const Group: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
pathname: '/group', | ||
}, | ||
}, | ||
}, | ||
render: () => { | ||
return <BottomNavigation />; | ||
}, | ||
}; | ||
|
||
export const Profile: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
pathname: '/profile/me', | ||
}, | ||
}, | ||
}, | ||
render: () => { | ||
return <BottomNavigation />; | ||
}, | ||
}; |
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,61 @@ | ||
'use client'; | ||
|
||
import { | ||
IconBookarchive, | ||
IconDiscover, | ||
IconGroup, | ||
IconProfile, | ||
} from '@public/icons'; | ||
import Link from 'next/link'; | ||
import { usePathname } from 'next/navigation'; | ||
|
||
const icons = [ | ||
{ | ||
icon: <IconBookarchive />, | ||
label: '북카이브', | ||
href: '/bookarchive', | ||
}, | ||
{ | ||
icon: <IconDiscover />, | ||
label: '도서 검색', | ||
href: '/book/search', | ||
}, | ||
{ | ||
icon: <IconGroup />, | ||
label: '독서 모임', | ||
href: '/group', | ||
}, | ||
{ | ||
icon: <IconProfile />, | ||
label: '내 프로필', | ||
href: '/profile/me', | ||
}, | ||
]; | ||
|
||
const iconColor = { | ||
active: 'fill-main-900 text-main-900', | ||
inactive: 'fill-placeholder text-placeholder', | ||
} as const; | ||
|
||
const BottomNavigation = () => { | ||
const pathname = usePathname(); | ||
|
||
return ( | ||
<div className="border-top-[0.05rem] fixed bottom-0 flex h-[6.4rem] w-full max-w-[39.3rem] justify-between border-black-200 bg-white px-[2.6rem] pb-[1.2rem] pt-[0.8rem]"> | ||
{icons.map(({ icon, label, href }) => ( | ||
<Link key={label} type="button" href={href}> | ||
<div | ||
className={`flex h-[4.4rem] w-[4.6rem] flex-col items-center justify-center text-xs font-bold ${ | ||
href === pathname ? iconColor.active : iconColor.inactive | ||
}`} | ||
> | ||
<div className="h-[2.6rem] w-[2.6rem] text-placeholder">{icon}</div> | ||
{label} | ||
</div> | ||
</Link> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BottomNavigation; |
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