All files / src/components/layout/gnb index.tsx

0% Statements 0/47
0% Branches 0/1
0% Functions 0/1
0% Lines 0/47

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                                                                                               
'use client';

import Link from 'next/link';
import { usePathname } from 'next/navigation';

import { Icon } from '@/components/icon';

export const GNB = () => {
  const pathname = usePathname();

  return (
    <nav className='sticky bottom-0 z-100 h-14 border-t-1 border-gray-200 bg-white py-2'>
      <ul className='flex w-full justify-evenly gap-4'>
        {NAV_MENU.map(({ path, svgId }) => (
          <li key={path}>
            <Link href={path} className='flex-center h-10 w-10'>
              <Icon id={svgId} className={pathname === path ? 'text-mint-500' : 'text-gray-500'} />
            </Link>
          </li>
        ))}
      </ul>
    </nav>
  );
};

const NAV_MENU = [
  {
    path: '/',
    svgId: 'home',
  },
  {
    path: '/schedule',
    svgId: 'calendar-1',
  },
  {
    path: '/create-group',
    svgId: 'plus-circle',
  },
  {
    path: '/message',
    svgId: 'message',
  },
  {
    path: '/mypage',
    svgId: 'user-1',
  },
] as const;