"use client";
import React from "react";
import { useField } from "@payloadcms/ui";
import { TextFieldClientComponent } from "payload";

const InputCountry: TextFieldClientComponent = ({ path, field }) => {
  const { value, setValue } = useField({ path });
  const { showError } = useField();

  return (
    <div className={`field-type select ${showError ? "has-error" : ""}`}>
      {/* @ts-ignore */}
      <span>jancok</span>
      {/* <label htmlFor={field.name} required={field.required}></label> */}
      <div className="select-input-wrapper">
        <select
          name={field.name}
          // @ts-ignore
          value={value}
          onChange={(e) => setValue(e.target.value)}
          disabled={field.admin?.readOnly}
        >
          <option value="">-- Select --</option>
          {/* {field.map((opt) => (
            <option key={opt.value} value={opt.value}>
              {opt.label}
            </option>
          ))} */}
        </select>
      </div>
      {/* {field.admin && <FieldDescription value={admin.description} />}
      {showError && <Error message={errorMessage} />} */}
    </div>
  );
};

export default InputCountry;
