@@ -14,37 +14,54 @@ interface EitherProps<T extends string> extends ConfigElementProps {
14
14
onChange : ( _ : T ) => void ;
15
15
}
16
16
17
- export const Either =
18
- < T extends string , > ( { id, a, b, aLabel = a , bLabel = b , value, onChange, ...rest } : EitherProps < T > ) => (
19
- < ConfigElement { ...rest } >
20
- < div className = { styles . toggle } >
21
- < input id = { `${ id } -a` }
22
- name = { id }
23
- value = { a }
24
- type = "radio"
25
- checked = { value === a }
26
- onChange = { ( ) => onChange ( a as T ) } />
27
- < label htmlFor = { `${ id } -a` } > { aLabel } </ label >
28
- < input id = { `${ id } -b` }
29
- name = { id }
30
- value = { b }
31
- type = "radio"
32
- checked = { value === b }
33
- onChange = { ( ) => onChange ( b as T ) } />
34
- < label htmlFor = { `${ id } -b` } > { bLabel } </ label >
35
- </ div >
36
- </ ConfigElement >
37
- ) ;
17
+ export const Either = < T extends string > ( {
18
+ id,
19
+ a,
20
+ b,
21
+ aLabel = a ,
22
+ bLabel = b ,
23
+ value,
24
+ onChange,
25
+ ...rest
26
+ } : EitherProps < T > ) => (
27
+ < ConfigElement { ...rest } >
28
+ < div className = { styles . toggle } >
29
+ < input
30
+ id = { `${ id } -a` }
31
+ name = { id }
32
+ value = { a }
33
+ type = "radio"
34
+ checked = { value === a }
35
+ onChange = { ( ) => onChange ( a as T ) }
36
+ />
37
+ < label htmlFor = { `${ id } -a` } > { aLabel } </ label >
38
+ < input
39
+ id = { `${ id } -b` }
40
+ name = { id }
41
+ value = { b }
42
+ type = "radio"
43
+ checked = { value === b }
44
+ onChange = { ( ) => onChange ( b as T ) }
45
+ />
46
+ < label htmlFor = { `${ id } -b` } > { bLabel } </ label >
47
+ </ div >
48
+ </ ConfigElement >
49
+ ) ;
38
50
39
51
interface SelectProps < T extends string > extends ConfigElementProps {
40
52
children : React . ReactNode ;
41
53
value : T ;
42
54
onChange : ( _ : T ) => void ;
43
55
}
44
56
45
- export const Select = < T extends string , > ( { value, onChange, children, ...rest } : SelectProps < T > ) => (
57
+ export const Select = < T extends string > ( {
58
+ value,
59
+ onChange,
60
+ children,
61
+ ...rest
62
+ } : SelectProps < T > ) => (
46
63
< ConfigElement { ...rest } >
47
- < select className = { styles . select } value = { value } onChange = { e => onChange ( e . target . value as T ) } >
64
+ < select className = { styles . select } value = { value } onChange = { ( e ) => onChange ( e . target . value as T ) } >
48
65
{ children }
49
66
</ select >
50
67
</ ConfigElement >
@@ -54,16 +71,14 @@ interface ConfigElementProps {
54
71
children ?: React . ReactNode ;
55
72
name : string ;
56
73
isNotDefault ?: boolean ;
57
- aside ?: JSX . Element ,
74
+ aside ?: JSX . Element ;
58
75
}
59
76
60
77
const ConfigElement : React . FC < ConfigElementProps > = ( { name, isNotDefault, aside, children } ) => (
61
78
< MenuItem >
62
79
< div className = { styles . container } >
63
80
< span className = { isNotDefault ? styles . notDefault : styles . name } > { name } </ span >
64
- < div className = { styles . value } >
65
- { children }
66
- </ div >
81
+ < div className = { styles . value } > { children } </ div >
67
82
</ div >
68
83
{ aside }
69
84
</ MenuItem >
0 commit comments