FormGroup.tsx 592 B

123456789101112131415161718192021222324252627
  1. import React, { SFC } from 'react';
  2. import { Label } from '..';
  3. interface Props {
  4. label: string;
  5. inputProps: {};
  6. labelWidth?: number;
  7. inputWidth?: number;
  8. }
  9. const defaultProps = {
  10. labelWidth: 6,
  11. inputProps: {},
  12. inputWidth: 12,
  13. };
  14. const FormGroup: SFC<Props> = ({ label, labelWidth, inputProps, inputWidth }) => {
  15. return (
  16. <div className="gf-form">
  17. <Label width={labelWidth}>{label}</Label>
  18. <input type="text" className={`gf-form-input width-${inputWidth}`} {...inputProps} />
  19. </div>
  20. );
  21. };
  22. FormGroup.defaultProps = defaultProps;
  23. export { FormGroup };