Total Complexity | 0 |
Complexity/F | 0 |
Lines of Code | 33 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 80% |
Changes | 0 |
1 | import React from 'react'; |
||
2 | import { v4 as uuid } from 'uuid'; |
||
3 | import PropTypes from 'prop-types'; |
||
4 | |||
5 | 3 | const propTypes = { |
|
6 | children: PropTypes.node.isRequired, |
||
7 | value: PropTypes.string.isRequired, |
||
8 | onChange: PropTypes.func.isRequired, |
||
9 | id: PropTypes.string, |
||
10 | type: PropTypes.string, |
||
11 | required: PropTypes.bool, |
||
12 | }; |
||
13 | |||
14 | 3 | export const HorizontalFormGroup = ({ children, value, onChange, id = uuid(), type = 'text', required = true }) => ( |
|
15 | 12 | <div className="form-group row"> |
|
16 | <label htmlFor={id} className="col-lg-1 col-md-2 col-form-label create-server__label"> |
||
17 | {children}: |
||
18 | </label> |
||
19 | <div className="col-lg-11 col-md-10"> |
||
20 | <input |
||
21 | className="form-control" |
||
22 | type={type} |
||
23 | id={id} |
||
24 | value={value} |
||
25 | required={required} |
||
26 | onChange={(e) => onChange(e.target.value)} |
||
27 | /> |
||
28 | </div> |
||
29 | </div> |
||
30 | ); |
||
31 | |||
32 | HorizontalFormGroup.propTypes = propTypes; |
||
33 |