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

feat: Move back button out of main component, ensure single main component only #2970

Merged
merged 5 commits into from
Apr 4, 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
5 changes: 1 addition & 4 deletions e2e/tests/ui-driven/src/create-flow/create-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,7 @@ test.describe("Navigation", () => {
page.locator("h3", { hasText: "Yes! this is a test" }),
).toBeVisible();

await page
.locator("#main-content")
.getByRole("button", { name: "Back" })
.click();
await page.getByTestId("backButton").click();

await answerQuestion({ page, title: "Is this a test?", answer: "No" });
await clickContinue({ page });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const MoreInfo: React.FC<IMoreInfo> = ({ open, children, handleClose }) => (
<CloseIcon />
</IconButton>
</CloseButton>
<Container maxWidth={false} role="main" sx={{ bgcolor: "white" }}>
<Container maxWidth={false} sx={{ bgcolor: "white" }}>
<DrawerContent>{children}</DrawerContent>
</Container>
<MoreInfoFeedbackComponent />
Expand Down
18 changes: 10 additions & 8 deletions editor.planx.uk/src/pages/Preview/Questions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const Questions = ({ previewEnvironment }: QuestionsProps) => {
);

return (
<Box width="100%" role="main">
<Box width="100%">
<BackBar hidden={!showBackBar}>
<Container maxWidth={false}>
<BackButton
Expand All @@ -181,13 +181,15 @@ const Questions = ({ previewEnvironment }: QuestionsProps) => {
</BackBar>

{node && (
<ErrorBoundary FallbackComponent={ErrorFallback}>
<Node
node={node}
key={node.id}
handleSubmit={handleSubmit(node.id!)}
/>
</ErrorBoundary>
<Box component="main" id="main-content">
<ErrorBoundary FallbackComponent={ErrorFallback}>
<Node
node={node}
key={node.id}
handleSubmit={handleSubmit(node.id!)}
/>
</ErrorBoundary>
</Box>
)}
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/pages/Preview/ResumePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const EmailRequired: React.FC<{ setEmail: (email: string) => void }> = ({
});

return (
<Box width="100%" role="main">
<Box width="100%" component="main">
<Card handleSubmit={formik.handleSubmit}>
<QuestionHeader
title="Resume your application"
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/pages/Preview/SaveAndReturn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ConfirmEmail: React.FC<{
});

return (
<Box width="100%" role="main">
<Box width="100%" component="main">
<Card handleSubmit={formik.handleSubmit}>
<QuestionHeader
title="Enter your email address"
Expand Down
10 changes: 5 additions & 5 deletions editor.planx.uk/src/pages/layout/PublicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ const PublicFooter: React.FC = () => {

const globalFooterItems = globalSettings?.footerContent
? Object.entries(globalSettings?.footerContent).map(([slug, item]) => ({
title: item.heading,
content: item.content,
href: makeHref(slug),
}))
title: item.heading,
content: item.content,
href: makeHref(slug),
}))
: [];

const footerItems = [...flowSettingsContent, ...globalFooterItems].filter(
Expand Down Expand Up @@ -96,7 +96,7 @@ const PublicLayout: React.FC<PropsWithChildren> = ({ children }) => {
<StyledEngineProvider injectFirst>
<ThemeProvider theme={teamMUITheme}>
<Header />
<MainContainer id="main-content">
DafyddLlyr marked this conversation as resolved.
Show resolved Hide resolved
<MainContainer>
<ErrorBoundary FallbackComponent={ErrorFallback}>
{children}
</ErrorBoundary>
Expand Down
Loading