import type { ComponentType, ReactNode } from "react";
import type { LucideProps } from "lucide-react";
import { CardHeader } from "~/components/ui/card";
import { GradientIcon } from "~/components/ui/GradientIcon";

interface SectionCardHeaderProps {
  icon: ComponentType<LucideProps>;
  title: string;
  right?: ReactNode;
}

/**
 * Consistent header for top-level section cards (My Leagues, Create a League, etc.).
 * Renders a gradient icon + xl bold title, with an optional right-side slot.
 */
export function SectionCardHeader({ icon, title, right }: SectionCardHeaderProps) {
  return (
    <CardHeader className="pb-2">
      <div className="flex items-center justify-between">
        <div className="flex items-center gap-2">
          <GradientIcon icon={icon} className="h-5 w-5 shrink-0" />
          <h2 className="text-xl font-bold leading-none tracking-tight">{title}</h2>
        </div>
        {right}
      </div>
    </CardHeader>
  );
}
