Skip to content

Commit

Permalink
feat: Move 'Change' button from section headers
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Feb 9, 2024
1 parent 9038dd6 commit 2ed982f
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ function SummaryListsBySections(props: SummaryListsBySectionsProps) {
state.getSortedBreadcrumbsBySection,
]);

const { trackBackwardsNavigation } = useAnalyticsTracking();

const isValidComponent = ([nodeId, userData]: BreadcrumbEntry) => {
const node = props.flow[nodeId];
const doesNodeExist = Boolean(props.flow[nodeId]);
Expand Down Expand Up @@ -160,11 +158,6 @@ function SummaryListsBySections(props: SummaryListsBySectionsProps) {
.map(removeNonPresentationalNodes)
.map((section) => section.map(makeSummaryBreadcrumb));

const handleChangeAnswer = (id: string) => {
trackBackwardsNavigation("change", id);
props.changeAnswer(id);
};

return (
<>
{sectionsWithFilteredBreadcrumbs.map(
Expand All @@ -184,25 +177,13 @@ function SummaryListsBySections(props: SummaryListsBySectionsProps) {
>
{props.flow[`${Object.keys(sections[i])[0]}`]?.data?.title}
</Typography>
<Link
onClick={() =>
handleChangeAnswer(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={false}
showChangeButton={props.showChangeButton}
/>
</React.Fragment>
),
Expand Down

0 comments on commit 2ed982f

Please sign in to comment.