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

interface IProps {
  label?: string;
  value?: string;
  disabled?: boolean;
  onChange?: (value: string) => void;
}

const InputField: React.FC<IProps> = props => {
  const { label = '标签', value, onChange, disabled } = props;
  return (
    <div className="group">
      <label>{label}</label>
      <Input
        value={value}
        style={{
          height: FormItemHeight,
        }}
        disabled={disabled}
        onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
          onChange?.(e.target.value);
        }}
      />
    </div>
  );
};

export default InputField;
