import { Button } from "@/components/ui/button";
import { useLocale } from "use-intl";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { cn } from "@/lib/utils";
interface SectionTitleProps {
  subtitle?: string;
  title: string;
  className?: string;
  hint?: string;
  onClick?: () => void;
}

export default function SectionTitle({
  subtitle,
  title,
  hint,
  className = "",
  onClick,
}: SectionTitleProps) {
  const locale = useLocale();
  const isRTL = locale === "ar";
  return (
    <div
      className={cn(
        "section-header",
        onClick && "flex items-center gap-[10px]",
        className,
      )}
    >
      {onClick && (
        <Button
          onClick={onClick}
          className={cn(
            "w-[32px] h-[32px] sm:w-[48px] sm:h-[48px] rounded-full flex items-center justify-center p-0",
            "text-vendor-primary bg-[#f2f0f5] hover:bg-vendor-primary hover:text-white transition-colors duration-300 ease-in-out",
            "has-[>svg]:p-0 [&_svg:not([class*='size-'])]:size-5 md:[&_svg:not([class*='size-'])]:size-6",
          )}
        >
          {isRTL ? <ChevronRight /> : <ChevronLeft />}
        </Button>
      )}
      {subtitle && (
        <h3 className={`text-[16px] uppercase text-secondary-brown_sugar-main`}>
          {subtitle}
        </h3>
      )}
      <h2
        className={`uppercase text-[24px] sm:text-[32px] md:text-[48px] font-bold text-vendor-primary`}
      >
        {title}{" "}
        {hint && (
          <span className="text-[20px] sm:text-[32px] normal-case">
            {" "}
            ({hint})
          </span>
        )}
      </h2>
    </div>
  );
}
