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

interface IProps {
  label?: string;
  value?: number;
  min?: number;
  width?: number;
  style?: object;
  onChange?: (value: number) => void;
}

const InputNumberField: React.FC<IProps> = (props) => {
  const { label, value, onChange, min, width ,style} = props;
  return (
    <div className="group" style={style}>
      {label && <label>{label}</label>}
      <InputNumber
        value={value}
        min={min}
        style={{
          width,
          height: FormItemHeight,
        }}
        onChange={(v: number) => {
          onChange?.(v);
        }}
      />
    </div>
  );
};

export default InputNumberField;
