Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#361] BottomNavigation 컴포넌트 #392

Merged
merged 9 commits into from
Aug 16, 2023
15 changes: 7 additions & 8 deletions src/ui/Base/BottomNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@ const icons = [
const BottomNavigation = () => {
const pathname = usePathname();

const getIconColorClasses = (href: string) => {
return href === pathname
? 'fill-main-900 text-main-900'
: 'fill-placeholder text-placeholder';
};
const iconColor = {
hanyugeon marked this conversation as resolved.
Show resolved Hide resolved
active: 'fill-main-900 text-main-900',
inactive: 'fill-placeholder text-placeholder',
} as const;

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 ${getIconColorClasses(
href
)}`}
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}
Expand Down