navTabs.tsx 934 B

123456789101112131415161718192021222324252627282930
  1. 'use client';
  2. import './style.scss';
  3. import React from 'react';
  4. import Link from 'next/link';
  5. import { usePathname } from 'next/navigation';
  6. export default function NavTabs() {
  7. const pathname = usePathname();
  8. return (
  9. <div id="tabs">
  10. {[
  11. { href: "/profile", label: "내 정보" },
  12. { href: "/change-password", label: "비밀번호 변경" },
  13. { href: "/my-posts", label: "작성 게시글" },
  14. { href: "/my-comments", label: "작성 댓글" },
  15. { href: "/exp-logs", label: "경험치 내역" },
  16. { href: "/login-log", label: "로그인 기록" },
  17. { href: "/withdraw", label: "회원탈퇴" },
  18. { href: "/cash", label:"캐시 충전"}
  19. ].map(({ href, label }, index, array) => (
  20. <React.Fragment key={href}>
  21. <Link href={href} className={pathname === href ? 'active' : ''}>{label}</Link>
  22. {index !== array.length - 1 && <span>&nbsp;</span>}
  23. </React.Fragment>
  24. ))}
  25. </div>
  26. );
  27. }