import Link from 'next/link';
import { plazaPath } from '@/lib/site';

export function FeedTabs({
  sort,
  categorySlug,
}: {
  sort: 'hot' | 'new';
  categorySlug?: string;
}) {
  const base = categorySlug ? plazaPath(`cat/${categorySlug}`) : plazaPath();

  return (
    <div className="inline-flex rounded-full bg-[#ebe4d6] p-1">
      <Link
        href={`${base}?sort=hot`}
        className={`rounded-full px-4 py-2 text-sm font-semibold transition ${
          sort === 'hot' ? 'bg-[#fffdf7] text-[#17221d] shadow-sm' : 'text-[#68716c]'
        }`}
      >
        热门
      </Link>
      <Link
        href={`${base}?sort=new`}
        className={`rounded-full px-4 py-2 text-sm font-semibold transition ${
          sort === 'new' ? 'bg-[#fffdf7] text-[#17221d] shadow-sm' : 'text-[#68716c]'
        }`}
      >
        最新
      </Link>
    </div>
  );
}
