Skip to content

Commit

Permalink
refactor: getIconColorClasses()를 조건반환문 으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed Aug 13, 2023
1 parent 7db350f commit f844d3f
Showing 1 changed file with 7 additions and 8 deletions.
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 = {
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

0 comments on commit f844d3f

Please sign in to comment.