Total Complexity | 0 |
Complexity/F | 0 |
Lines of Code | 30 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 66.67% |
Changes | 0 |
1 | import { FC } from 'react'; |
||
2 | import { v4 as uuid } from 'uuid'; |
||
3 | import { InputType } from 'reactstrap/lib/Input'; |
||
4 | |||
5 | interface FormGroupContainer { |
||
6 | value: string; |
||
7 | onChange: (newValue: string) => void; |
||
8 | id?: string; |
||
9 | type?: InputType; |
||
10 | required?: boolean; |
||
11 | } |
||
12 | |||
13 | 3 | export const FormGroupContainer: FC<FormGroupContainer> = ( |
|
14 | { children, value, onChange, id = uuid(), type = 'text', required = true }, |
||
15 | ) => ( |
||
16 | 12 | <div className="form-group"> |
|
17 | <label htmlFor={id} className="create-server__label"> |
||
18 | {children}: |
||
19 | </label> |
||
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 | ); |
||
30 |