-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathAgeRadioButtonGroup.tsx
38 lines (35 loc) · 1.37 KB
/
AgeRadioButtonGroup.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import * as React from 'react';
export const AgeRadioButtonGroup = (props: any) => {
const uniqueId = Math.random().toString(36);
return (
<div onChange={props.handleClickAgeRadio} className={props.className}>
<input
data-testid='adjusted'
type="radio"
id={`adjusted-${uniqueId}`}
value="adjusted"
name={`adjustments${uniqueId}`}
defaultChecked={props.correctedAge && props.chronologicalAge === false}
/>
<label htmlFor={`adjusted-${uniqueId}`}>Corrected Age</label>
<input
data-testid='unadjusted'
type="radio"
id={`unadjusted-${uniqueId}`}
value="unadjusted"
name={`adjustments${uniqueId}`}
defaultChecked={props.chronologicalAge && props.correctedAge === false}
/>
<label htmlFor={`unadjusted-${uniqueId}`}>Chronological Age</label>
<input
data-testid='both'
type="radio"
id={`both-${uniqueId}`}
value="both"
name={`adjustments${uniqueId}`}
defaultChecked={props.correctedAge === props.chronologicalAge}
/>
<label htmlFor={`both-${uniqueId}`}>Both Ages</label>
</div>
);
};