import type { ReactNode } from "react";

interface ListingHeaderProps {
  title: string;
  colorClassName?: string;
  children: ReactNode;
}

/** Compact heading and search/actions shared by public listing pages. */
export default function ListingHeader({
  title,
  colorClassName = "text-primary-5",
  children,
}: ListingHeaderProps) {
  return (
    <div className="flex flex-col gap-3 mb-4 sm:flex-row sm:items-center sm:justify-between">
      <h1 className={`min-w-0 text-2xl md:text-[28px] 2xl:text-[32px] leading-tight font-bold ${colorClassName}`}>
        {title}
      </h1>
      <div className="flex flex-wrap items-center gap-3 sm:ms-auto [&_.searchitms]:!w-full [&_.searchitms]:!h-10 [&_.searchitms_input]:!text-sm [&_.searchitms>div]:!w-5 [&_.searchitms>div]:!h-5 [&_.searchitms_button]:!w-5 [&_.searchitms_button]:!h-5">
        {children}
      </div>
    </div>
  );
}
