import React from 'react';
import { Select } from 'antd';
import { FormItemHeight } from '../constants';

const { Option } = Select;

interface IOption {
  label?: string | Number;
  value?: string | Number;
}

interface IProps {
  label?: string;
  value?: any;
  // options?: IOption[];
  onChange?: (value: string) => void;
}

const InputField: React.FC<IProps> = (props) => {
  const { label = '标签', value, onChange } = props;
  const options = [
    {
      label: 'plc1',
      value: 1,
    },
    {
      label: 'plc2',
      value: 2,
    },
    {
      label: 'plc3',
      value: 3,
    },
  ];
  return (
    <div className="group">
      <label>{label}</label>
      <Select
        value={value}
        style={{
          height: FormItemHeight,
        }}
        onChange={(value: any) => {
          onChange?.(value);
        }}
      >
        {options.map((item) => (
          <Option value={item.value}>{item.label}</Option>
        ))}
      </Select>
    </div>
  );
};

export default InputField;
