import { PostList } from "@/app/components/PostList";

export default function SearchPage({ searchParams }: { searchParams?: { q?: string; sort?: "recent" | "popular"; tag?: string; author?: string; start?: string; end?: string } }) {
  const q = searchParams?.q ?? "";
  const sort = searchParams?.sort ?? "recent";
  const { tag = "", author = "", start = "", end = "" } = searchParams ?? {};
  return (
    <div>
      <h2 style={{ marginBottom: 12 }}>검색: {q || tag || author || (start && end ? `${start}~${end}` : "전체")}</h2>
      <PostList q={q} sort={sort} tag={tag} author={author} start={start} end={end} />
    </div>
  );
}


