input.tsx 698 B

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { Input } from 'antd';
  3. import { FormItemHeight } from '../constants';
  4. interface IProps {
  5. label?: string;
  6. value?: string;
  7. disabled?: boolean;
  8. onChange?: (value: string) => void;
  9. }
  10. const InputFiled: React.FC<IProps> = props => {
  11. const { label = '标签', value, onChange, disabled } = props;
  12. return (
  13. <div className="group">
  14. <label>{label}</label>
  15. <Input
  16. value={value}
  17. style={{
  18. height: FormItemHeight,
  19. }}
  20. disabled={disabled}
  21. onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
  22. onChange?.(e.target.value);
  23. }}
  24. />
  25. </div>
  26. );
  27. };
  28. export default InputFiled;