layout.tsx 901 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use client';
  2. import '@/app/styles/note.scss';
  3. import Link from 'next/link';
  4. import { usePathname } from 'next/navigation';
  5. export default function NoteLayout({ children }: { children: React.ReactNode })
  6. {
  7. const pathname = usePathname();
  8. const isInbox = pathname?.startsWith('/note/inbox');
  9. const isOutbox = pathname?.startsWith('/note/outbox');
  10. return (
  11. <div className="note-page">
  12. <nav className="note-page__tabs" role="tablist" aria-label="쪽지함">
  13. <Link
  14. href="/note/inbox"
  15. role="tab"
  16. aria-selected={isInbox}
  17. className={`note-page__tab${isInbox ? ' note-page__tab--active' : ''}`}
  18. >
  19. 받은 쪽지함
  20. </Link>
  21. <Link
  22. href="/note/outbox"
  23. role="tab"
  24. aria-selected={isOutbox}
  25. className={`note-page__tab${isOutbox ? ' note-page__tab--active' : ''}`}
  26. >
  27. 보낸 쪽지함
  28. </Link>
  29. </nav>
  30. {children}
  31. </div>
  32. );
  33. }