import type { ReactNode } from "react";

import { cn } from "@/lib/ui/variants";

import { Eyebrow } from "./Eyebrow";

interface SectionHeaderProps {
  title: string;
  eyebrow?: string;
  description?: ReactNode;
  action?: ReactNode;
  className?: string;
}

export function SectionHeader({
  title,
  eyebrow,
  description,
  action,
  className,
}: SectionHeaderProps) {
  return (
    <div className={cn("flex items-start justify-between gap-4", className)}>
      <div className="min-w-0">
        {eyebrow ? <Eyebrow className="mb-1">{eyebrow}</Eyebrow> : null}
        <h2 className="font-serif text-title-md text-ink">{title}</h2>
        {description ? (
          <p className="mt-1 text-sm leading-6 text-ink-soft">{description}</p>
        ) : null}
      </div>
      {action ? <div className="shrink-0">{action}</div> : null}
    </div>
  );
}
