import React from 'react';
import { InputNumber } from 'antd';

function NumberField(props) {
  const { onChange, disabled, unit } = props;

  return (
    <InputNumber
      style={{ width: '100%' }}
      disabled={disabled}
      formatter={value => `${value}${unit || ''}`}
      onChange={e => {
        onChange?.(String(e));
      }}
    />
  );
}

export default NumberField;
