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

demo: move change link to section title + help text update #2481

Merged
merged 4 commits into from
Dec 7, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const HelpButtonWrapper = styled(Box)(({ theme }) => ({
width: HelpButtonMinWidth,
top: "-4px",
right: "-6px",
pointerEvents: "none",
[theme.breakpoints.up("md")]: {
width: "80px",
top: 0,
Expand All @@ -72,6 +73,7 @@ export const HelpButton = styled(Button)(({ theme }) => ({
boxShadow: "none",
fontSize: "1.125em",
filter: "drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.5))",
pointerEvents: "auto",
[theme.breakpoints.up("lg")]: {
minHeight: "48px",
fontSize: "1.25em",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default SummaryListsBySections;

const Grid = styled("dl")(({ theme }) => ({
display: "grid",
gridTemplateColumns: "1fr 2fr 100px",
gridTemplateColumns: "1fr 2fr",
gridRowGap: "10px",
marginTop: theme.spacing(4),
marginTop: theme.spacing(2),
marginBottom: theme.spacing(4),
"& > *": {
borderBottom: `1px solid ${theme.palette.border.main}`,
Expand All @@ -39,10 +39,7 @@ const Grid = styled("dl")(({ theme }) => ({
// middle column
paddingLeft: "10px",
},
"& dd:nth-of-type(2n)": {
// right column
textAlign: "right",
},

}));

const presentationalComponents: {
Expand Down Expand Up @@ -161,20 +158,28 @@ function SummaryListsBySections(props: SummaryListsBySectionsProps) {
(filteredBreadcrumbs, i) =>
Boolean(filteredBreadcrumbs.length) && (
<React.Fragment key={i}>
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
<Box sx={{ display: "flex", justifyContent: "space-between", mt: 5 }}>
<Typography
component={props.sectionComponent || "h2"}
variant="h4"
variant="h3"
>
{props.flow[`${Object.keys(sections[i])[0]}`]?.data?.title}
</Typography>
<Link
onClick={() => props.changeAnswer(filteredBreadcrumbs[0].nodeId)}
component="button"
fontSize="body1.fontSize"
>
Change
<span style={visuallyHidden}>the answers in this section</span>
</Link>
</Box>
<SummaryList
summaryBreadcrumbs={filteredBreadcrumbs}
flow={props.flow}
passport={props.passport}
changeAnswer={props.changeAnswer}
showChangeButton={props.showChangeButton}
showChangeButton={false}
/>
</React.Fragment>
),
Expand Down Expand Up @@ -219,8 +224,8 @@ function SummaryList(props: SummaryListProps) {
flow={props.flow}
passport={props.passport}
/>
<dd>
{props.showChangeButton && (
{props.showChangeButton && (
<dd>
<Link
onClick={() => handleChangeAnswer(nodeId)}
component="button"
Expand All @@ -231,8 +236,8 @@ function SummaryList(props: SummaryListProps) {
{node.data?.title || node.data?.text || "this answer"}
</span>
</Link>
)}
</dd>
</dd>
)}
</React.Fragment>
),
)}
Expand Down
Loading