import { Input } from "@/components/ui/input";

export function UrlField({
  id,
  label,
  hint,
  value,
  onChange,
  placeholder,
  autoFocus,
}: {
  id: string;
  label: string;
  hint: string;
  value: string;
  onChange: (value: string) => void;
  placeholder: string;
  autoFocus?: boolean;
}) {
  return (
    <div className="grid gap-1.5">
      <label htmlFor={id} className="flex flex-wrap items-baseline gap-x-2">
        <span className="text-[15px] font-semibold text-neutral-900">{label}</span>
        <span className="text-[13px] text-neutral-400">{hint}</span>
      </label>
      <Input
        id={id}
        name={id}
        type="text"
        inputMode="url"
        value={value}
        onChange={(event) => onChange(event.target.value)}
        placeholder={placeholder}
        autoComplete="url"
        spellCheck={false}
        autoFocus={autoFocus}
        className="h-12 border-2 border-neutral-300 bg-white px-3 text-[16px] text-neutral-900 placeholder:text-neutral-400"
      />
    </div>
  );
}
