Skip to content

Commit 8bec834

Browse files
committed
Update the Next 13 AppDir setup
1 parent 96102f2 commit 8bec834

File tree

8 files changed

+940
-36
lines changed

8 files changed

+940
-36
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"use client";
2+
3+
import { MainNavigation } from "@codegouvfr/react-dsfr/MainNavigation";
4+
import { useSelectedLayoutSegment } from "next/navigation";
5+
6+
export function Navigation() {
7+
8+
const segment = useSelectedLayoutSegment();
9+
10+
return (
11+
<MainNavigation
12+
items={[
13+
{
14+
"text": "Home",
15+
"linkProps": {
16+
"href": "/"
17+
},
18+
"isActive": segment === null
19+
},
20+
{
21+
"text": "Mui playground",
22+
"linkProps": {
23+
"href": "/mui"
24+
},
25+
"isActive": segment === "mui"
26+
}
27+
]}
28+
/>
29+
);
30+
31+
}

test/integration/next-appdir/app/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Header } from "@codegouvfr/react-dsfr/Header";
99
import { Footer } from "@codegouvfr/react-dsfr/Footer";
1010
import { Display, headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
1111
import { fr } from "@codegouvfr/react-dsfr";
12+
import { Navigation } from "./Navigation";
1213

1314
const brandTop = <>INTITULE<br />OFFICIEL</>;
1415

@@ -19,6 +20,7 @@ export default function RootLayout({ children }: { children: JSX.Element; }) {
1920
return (
2021
<html {...getColorSchemeHtmlAttributes({ defaultColorScheme })} >
2122
<head>
23+
<title>Next 13 AppDir Demo DSFR setup</title>
2224
<StartDsfr />
2325
<DsfrHead
2426
defaultColorScheme={defaultColorScheme}
@@ -45,10 +47,12 @@ export default function RootLayout({ children }: { children: JSX.Element; }) {
4547
serviceTitle="Nom du site / service"
4648
homeLinkProps={homeLinkPops}
4749
quickAccessItems={[headerFooterDisplayItem]}
50+
navigation={<Navigation />}
4851
/>
4952
<div style={{
5053
"margin": "auto",
5154
"maxWidth": 1000,
55+
"minHeight": "calc(100vh - 208px - 231px - 37px)",
5256
...fr.spacing("padding", {
5357
"topBottom": "10v"
5458
})
@@ -69,7 +73,6 @@ export default function RootLayout({ children }: { children: JSX.Element; }) {
6973
bottomItems={[headerFooterDisplayItem]}
7074
/>
7175
<Display />
72-
7376
</MuiDsfrThemeProvider>
7477
</NextAppDirEmotionCacheProvider>
7578
</DsfrProvider>

0 commit comments

Comments
 (0)