Skip to content

Commit 637e26a

Browse files
authoredJun 15, 2024
Merge pull request #87 from rcpch:id-rename
radiobutton-dynamic-naming
2 parents 22b0a61 + a9dbee3 commit 637e26a

File tree

8 files changed

+127
-113
lines changed

8 files changed

+127
-113
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rcpch/digital-growth-charts-react-component-library",
3-
"version": "7.0.1",
3+
"version": "7.0.2",
44
"description": "A React component library for the RCPCH digital growth charts using Rollup, TypeScript and Styled-Components",
55
"main": "build/index.js",
66
"module": "build/esm.index.js",

‎src/CentileChart/CentileChart.tsx

+94-86
Large diffs are not rendered by default.

‎src/RCPCHChart/RCPCHChart.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const PrematureSDSChart: Story = {
100100
chartType: 'sds',
101101
enableExport: false,
102102
exportChartCallback: ()=>{},
103-
theme: 'tanner3',
103+
theme: 'tanner2',
104104
customThemeStyles: {}
105105
},
106106
};

‎src/SDSChart/SDSChart.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ const SDSChart: React.FC<SDSChartProps> = (
597597
$fontStyle={styles.toggleStyle.fontStyle}
598598
$color={styles.toggleStyle.color}
599599
$className={"toggleButtons"}
600-
handleClick={onSelectRadioButton}
600+
handleClickAgeRadio={onSelectRadioButton}
601601
correctedAge={showCorrectedAge}
602602
chronologicalAge={showChronologicalAge}
603603
/>
+13-10
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
import * as React from 'react';
22

33
export const AgeRadioButtonGroup = (props: any) => {
4+
5+
const uniqueId = Math.random().toString(36);
6+
47
return (
5-
<div onChange={props.handleClick} className={props.className}>
8+
<div onChange={props.handleClickAgeRadio} className={props.className}>
69
<input
710
data-testid='adjusted'
811
type="radio"
9-
id="adjusted"
12+
id={`adjusted-${uniqueId}`}
1013
value="adjusted"
11-
name="adjustments"
14+
name={`adjustments${uniqueId}`}
1215
defaultChecked={props.correctedAge && props.chronologicalAge === false}
1316
/>
14-
<label htmlFor="adjusted">Corrected Age</label>
17+
<label htmlFor={`adjusted-${uniqueId}`}>Corrected Age</label>
1518
<input
1619
data-testid='unadjusted'
1720
type="radio"
18-
id="unadjusted"
21+
id={`unadjusted-${uniqueId}`}
1922
value="unadjusted"
20-
name="adjustments"
23+
name={`adjustments${uniqueId}`}
2124
defaultChecked={props.chronologicalAge && props.correctedAge === false}
2225
/>
23-
<label htmlFor="unadjusted">Chronological Age</label>
26+
<label htmlFor={`unadjusted-${uniqueId}`}>Chronological Age</label>
2427
<input
2528
data-testid='both'
2629
type="radio"
27-
id="both"
30+
id={`both-${uniqueId}`}
2831
value="both"
29-
name="adjustments"
32+
name={`adjustments${uniqueId}`}
3033
defaultChecked={props.correctedAge === props.chronologicalAge}
3134
/>
32-
<label htmlFor="both">Both Ages</label>
35+
<label htmlFor={`both-${uniqueId}`}>Both Ages</label>
3336
</div>
3437
);
3538
};

‎src/SubComponents/StyledResetZoomButton.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const StyledResetZoomButton = styled.button<{
1414
align-self: flex-end;
1515
background-color: ${({$enabled, $activeColour, $inactiveColour}) => ($enabled ? $activeColour : $inactiveColour)};
1616
border: 2px solid ${({$enabled, $activeColour, $inactiveColour}) => ($enabled ? $activeColour : $inactiveColour)};
17+
border-radius: 0px;
18+
margin: ${({ $margin }) => $margin};
1719
font-family: Arial;
1820
font-size: 14px;
1921
min-height: 30px;

‎src/functions/makeAllStyles.ts

+1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ function makeAllStyles(
270270
color: chartStyle?.toggleButtonTextStyle?.colour ?? white,
271271
fontSize: chartStyle?.toggleButtonTextStyle?.size ?? 14,
272272
fontStyle: chartStyle?.toggleButtonTextStyle?.style === 'italic' ? 'italic' : 'normal',
273+
margin: 0
273274
},
274275
};
275276
}

‎src/testParameters/styles/tanner2Styles.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ export const Tanner2ChartStyles: ChartStyle = {
3434
size: 12,
3535
style: 'italic'
3636
},
37-
tooltipBackgroundColour: "#fdc300",
38-
tooltipStroke: "#fdc300",
37+
tooltipBackgroundColour: "#3366cc",
38+
tooltipStroke: "##3366cc",
3939
tooltipTextStyle: {
4040
name: "Montserrat",
41-
colour: "#000000",
41+
colour: "#FFFFFF",
4242
size: 14,
4343
style: 'normal'
4444
},
@@ -63,10 +63,10 @@ export const Tanner2GridlineStyles: GridlineStyle = {
6363

6464
export const Tanner2CentileStyles: CentileStyle = {
6565
sdsStroke: "#A9A9A9",
66-
centileStroke: "#7159aa",
67-
delayedPubertyAreaFill: "#c6bddd",
66+
centileStroke: "#ff8000",
67+
delayedPubertyAreaFill: "#ffc080",
6868
midParentalCentileStroke: "#ff8000",
69-
midParentalAreaFill: "#c6bddd",
69+
midParentalAreaFill: "#ffc080",
7070
}
7171

7272
export const Tanner2MeasurementStyles: MeasurementStyle = {
@@ -80,10 +80,10 @@ export const Tanner2MeasurementStyles: MeasurementStyle = {
8080
}
8181
}
8282
export const Tanner2SDSStyles: SDSStyle = {
83-
heightStroke: "#ff8000ff",
84-
weightStroke: "#ff80007f",
85-
ofcStroke: "#ff80003f",
86-
bmiStroke: "#ff80001f",
83+
heightStroke: "#7159aa",
84+
weightStroke: "#ff8000",
85+
ofcStroke: "#e60700",
86+
bmiStroke: "#c2a712",
8787
}
8888

8989
/*
@@ -234,28 +234,28 @@ export const Tanner2Styles = {
234234
},
235235
"heightSDS": {
236236
"data": {
237-
"stroke": "#ff8000ff",
237+
"stroke": "#7159aa",
238238
"strokeWidth": 1.5,
239239
"strokeLinecap": "round"
240240
}
241241
},
242242
"weightSDS": {
243243
"data": {
244-
"stroke": "#ff80007f",
244+
"stroke": "#ff8000",
245245
"strokeWidth": 1.5,
246246
"strokeLinecap": "round"
247247
}
248248
},
249249
"ofcSDS": {
250250
"data": {
251-
"stroke": "#ff80003f",
251+
"stroke": "#e60700",
252252
"strokeWidth": 1.5,
253253
"strokeLinecap": "round"
254254
}
255255
},
256256
"bmiSDS": {
257257
"data": {
258-
"stroke": "#ff80001f",
258+
"stroke": "#c2a712",
259259
"strokeWidth": 1.5,
260260
"strokeLinecap": "round"
261261
}

0 commit comments

Comments
 (0)