Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

radiobutton-dynamic-naming #87

Merged
merged 5 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rcpch/digital-growth-charts-react-component-library",
"version": "7.0.1",
"version": "7.0.2",
"description": "A React component library for the RCPCH digital growth charts using Rollup, TypeScript and Styled-Components",
"main": "build/index.js",
"module": "build/esm.index.js",
Expand Down
180 changes: 94 additions & 86 deletions src/CentileChart/CentileChart.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/RCPCHChart/RCPCHChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const PrematureSDSChart: Story = {
chartType: 'sds',
enableExport: false,
exportChartCallback: ()=>{},
theme: 'tanner3',
theme: 'tanner2',
customThemeStyles: {}
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/SDSChart/SDSChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ const SDSChart: React.FC<SDSChartProps> = (
$fontStyle={styles.toggleStyle.fontStyle}
$color={styles.toggleStyle.color}
$className={"toggleButtons"}
handleClick={onSelectRadioButton}
handleClickAgeRadio={onSelectRadioButton}
correctedAge={showCorrectedAge}
chronologicalAge={showChronologicalAge}
/>
Expand Down
23 changes: 13 additions & 10 deletions src/SubComponents/AgeRadioButtonGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
import * as React from 'react';

export const AgeRadioButtonGroup = (props: any) => {

const uniqueId = Math.random().toString(36);

return (
<div onChange={props.handleClick} className={props.className}>
<div onChange={props.handleClickAgeRadio} className={props.className}>
<input
data-testid='adjusted'
type="radio"
id="adjusted"
id={`adjusted-${uniqueId}`}
value="adjusted"
name="adjustments"
name={`adjustments${uniqueId}`}
defaultChecked={props.correctedAge && props.chronologicalAge === false}
/>
<label htmlFor="adjusted">Corrected Age</label>
<label htmlFor={`adjusted-${uniqueId}`}>Corrected Age</label>
<input
data-testid='unadjusted'
type="radio"
id="unadjusted"
id={`unadjusted-${uniqueId}`}
value="unadjusted"
name="adjustments"
name={`adjustments${uniqueId}`}
defaultChecked={props.chronologicalAge && props.correctedAge === false}
/>
<label htmlFor="unadjusted">Chronological Age</label>
<label htmlFor={`unadjusted-${uniqueId}`}>Chronological Age</label>
<input
data-testid='both'
type="radio"
id="both"
id={`both-${uniqueId}`}
value="both"
name="adjustments"
name={`adjustments${uniqueId}`}
defaultChecked={props.correctedAge === props.chronologicalAge}
/>
<label htmlFor="both">Both Ages</label>
<label htmlFor={`both-${uniqueId}`}>Both Ages</label>
</div>
);
};
2 changes: 2 additions & 0 deletions src/SubComponents/StyledResetZoomButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const StyledResetZoomButton = styled.button<{
align-self: flex-end;
background-color: ${({$enabled, $activeColour, $inactiveColour}) => ($enabled ? $activeColour : $inactiveColour)};
border: 2px solid ${({$enabled, $activeColour, $inactiveColour}) => ($enabled ? $activeColour : $inactiveColour)};
border-radius: 0px;
margin: ${({ $margin }) => $margin};
font-family: Arial;
font-size: 14px;
min-height: 30px;
Expand Down
1 change: 1 addition & 0 deletions src/functions/makeAllStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ function makeAllStyles(
color: chartStyle?.toggleButtonTextStyle?.colour ?? white,
fontSize: chartStyle?.toggleButtonTextStyle?.size ?? 14,
fontStyle: chartStyle?.toggleButtonTextStyle?.style === 'italic' ? 'italic' : 'normal',
margin: 0
},
};
}
Expand Down
28 changes: 14 additions & 14 deletions src/testParameters/styles/tanner2Styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export const Tanner2ChartStyles: ChartStyle = {
size: 12,
style: 'italic'
},
tooltipBackgroundColour: "#fdc300",
tooltipStroke: "#fdc300",
tooltipBackgroundColour: "#3366cc",
tooltipStroke: "##3366cc",
tooltipTextStyle: {
name: "Montserrat",
colour: "#000000",
colour: "#FFFFFF",
size: 14,
style: 'normal'
},
Expand All @@ -63,10 +63,10 @@ export const Tanner2GridlineStyles: GridlineStyle = {

export const Tanner2CentileStyles: CentileStyle = {
sdsStroke: "#A9A9A9",
centileStroke: "#7159aa",
delayedPubertyAreaFill: "#c6bddd",
centileStroke: "#ff8000",
delayedPubertyAreaFill: "#ffc080",
midParentalCentileStroke: "#ff8000",
midParentalAreaFill: "#c6bddd",
midParentalAreaFill: "#ffc080",
}

export const Tanner2MeasurementStyles: MeasurementStyle = {
Expand All @@ -80,10 +80,10 @@ export const Tanner2MeasurementStyles: MeasurementStyle = {
}
}
export const Tanner2SDSStyles: SDSStyle = {
heightStroke: "#ff8000ff",
weightStroke: "#ff80007f",
ofcStroke: "#ff80003f",
bmiStroke: "#ff80001f",
heightStroke: "#7159aa",
weightStroke: "#ff8000",
ofcStroke: "#e60700",
bmiStroke: "#c2a712",
}

/*
Expand Down Expand Up @@ -234,28 +234,28 @@ export const Tanner2Styles = {
},
"heightSDS": {
"data": {
"stroke": "#ff8000ff",
"stroke": "#7159aa",
"strokeWidth": 1.5,
"strokeLinecap": "round"
}
},
"weightSDS": {
"data": {
"stroke": "#ff80007f",
"stroke": "#ff8000",
"strokeWidth": 1.5,
"strokeLinecap": "round"
}
},
"ofcSDS": {
"data": {
"stroke": "#ff80003f",
"stroke": "#e60700",
"strokeWidth": 1.5,
"strokeLinecap": "round"
}
},
"bmiSDS": {
"data": {
"stroke": "#ff80001f",
"stroke": "#c2a712",
"strokeWidth": 1.5,
"strokeLinecap": "round"
}
Expand Down
Loading