Skip to content

Commit b522c57

Browse files
Ruben van LeeuwenDutchBen
authored andcommitted
947: Create example form page and add it to the menu
1 parent 13d700f commit b522c57

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

pages/_app.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ import { SessionProvider } from "next-auth/react";
88
import { NextAdapter } from "next-query-params";
99
import App, { AppContext, AppInitialProps, AppProps } from "next/app";
1010
import Head from "next/head";
11+
import { useRouter } from "next/router";
1112
import { QueryParamProvider } from "use-query-params";
1213

14+
import type { EuiSideNavItemType } from "@elastic/eui";
1315
import { EuiProvider, EuiThemeColorMode } from "@elastic/eui";
1416
import "@elastic/eui/dist/eui_theme_light.min.css";
17+
1518
import {
1619
ColorModes,
1720
ConfirmationDialogContextWrapper,
@@ -20,6 +23,7 @@ import {
2023
StoreProvider,
2124
WfoAuth,
2225
WfoErrorBoundary,
26+
WfoMenuItemLink,
2327
WfoPageTemplate,
2428
WfoToastsList,
2529
defaultOrchestratorTheme,
@@ -47,6 +51,7 @@ function CustomApp({
4751
pageProps,
4852
orchestratorConfig,
4953
}: AppProps & AppOwnProps) {
54+
const router = useRouter();
5055
const [queryClient] = useState(() => new QueryClient(queryClientConfig));
5156

5257
const [themeMode, setThemeMode] = useState<EuiThemeColorMode>(
@@ -70,6 +75,25 @@ function CustomApp({
7075
}
7176
}, []);
7277

78+
const addMenuItems = (
79+
defaultMenuItems: EuiSideNavItemType<object>[]
80+
): EuiSideNavItemType<object>[] => [
81+
...defaultMenuItems,
82+
{
83+
name: "Example form",
84+
id: "10",
85+
isSelected: router.pathname === "/example-form",
86+
href: "/example-form",
87+
renderItem: () => (
88+
<WfoMenuItemLink
89+
path={"/example-form"}
90+
translationString="Example form"
91+
isSelected={router.pathname === "/example-form"}
92+
/>
93+
),
94+
},
95+
];
96+
7397
return (
7498
<WfoErrorBoundary>
7599
<OrchestratorConfigProvider
@@ -105,6 +129,9 @@ function CustomApp({
105129
onThemeSwitch={
106130
handleThemeSwitch
107131
}
132+
overrideMenuItems={
133+
addMenuItems
134+
}
108135
>
109136
<QueryParamProvider
110137
adapter={

pages/forms.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)