"use client"

import { Icon } from "@iconify/react"
import { techBrandIcon } from "@/lib/admin-settings/tech-brand-icons"
import { cn } from "@/lib/utils"

export function TechBrandSelectLabel({
  brand,
  icon,
  children,
  className,
  iconClassName,
  suffix,
}: {
  brand?: string
  icon?: string
  children: React.ReactNode
  className?: string
  iconClassName?: string
  suffix?: React.ReactNode
}) {
  const resolved = icon ?? (brand ? techBrandIcon(brand) : undefined)

  return (
    <span className={cn("inline-flex min-w-0 items-center gap-2", className)}>
      {resolved ? (
        <Icon icon={resolved} className={cn("size-4 shrink-0", iconClassName)} aria-hidden />
      ) : null}
      <span className="truncate">
        {children}
        {suffix}
      </span>
    </span>
  )
}
