import Link from "next/link";
import type { ReactNode } from "react";

interface SidebarLinkProps {
  href: string;
  label: string;
  icon?: ReactNode;
  /** 활성 경로 판단은 호출부(feature)가 현재 라우트를 비교해 전달한다. */
  isActive?: boolean;
}

/** 사이드바 내비게이션 항목. */
export function SidebarLink({ href, label, icon, isActive = false }: SidebarLinkProps) {
  return (
    <Link
      href={href}
      aria-current={isActive ? "page" : undefined}
      className={`flex items-center gap-3 rounded-lg px-3 py-2 text-body-md ${
        isActive
          ? "bg-primary-container text-on-primary-container"
          : "text-foreground-muted hover:bg-surface-muted hover:text-foreground"
      }`}
    >
      {icon}
      <span>{label}</span>
    </Link>
  );
}
