Skip to content

Commit 694de50

Browse files
committed
fix gdpr folder export
1 parent 07b49df commit 694de50

File tree

5 files changed

+187
-158
lines changed

5 files changed

+187
-158
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"module": "dist/fr/index.js",
122122
"exports": {
123123
".": "./dist/fr/index.js",
124-
"./gdpr": "./dist/gdpr.js",
124+
"./gdpr": "./dist/gdpr/index.js",
125125
"./spa": "./dist/spa.js",
126126
"./next-appdir": "./dist/next-appdir/index.js",
127127
"./next-appdir/DsfrHead": "./dist/next-appdir/DsfrHead.js",

src/scripts/list-exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const srcDirPath = pathJoin(getProjectRoot(), "src");
1414

1515
const newExports = {
1616
".": `./${packageJsonParsed["module"]}`,
17-
"./gdpr": "./dist/gdpr.js",
17+
"./gdpr": "./dist/gdpr/index.js",
1818
"./spa": "./dist/spa.js",
1919
"./next-appdir": "./dist/next-appdir/index.js",
2020
...Object.fromEntries(

test/integration/cra/src/index.tsx

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ import { fr } from "@codegouvfr/react-dsfr";
99
import { routes } from "./router";
1010
import { Display, headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
1111
import { GdprStoreProvider } from "@codegouvfr/react-dsfr/gdpr";
12+
import { ConsentBanner } from '@codegouvfr/react-dsfr/ConsentBanner';
1213

1314
startReactDsfr({
1415
"defaultColorScheme": "system"
1516
});
1617

18+
declare module "@codegouvfr/react-dsfr/gdpr" {
19+
interface RegisterGdprServices {
20+
matomo: never;
21+
}
22+
}
23+
1724
createRoot(document.getElementById("root")!).render(
1825
<StrictMode>
1926
<RouteProvider>
@@ -27,47 +34,54 @@ function Root() {
2734
const route = useRoute();
2835

2936
return (
30-
<div style={{
31-
"height": "100vh",
32-
"display": "flex",
33-
"flexDirection": "column",
34-
}}>
35-
<Header
36-
brandTop={<>INTITULE<br />OFFICIEL</>}
37-
serviceTitle="Nom du site / service"
38-
quickAccessItems={[headerFooterDisplayItem]}
39-
homeLinkProps={{ ...routes.home().link, "title": "Accueil - Nom de l’entité (ministère, secrétariat d‘état, gouvernement)" }}
40-
navigation={[
41-
{
42-
"text": "Home",
43-
"linkProps": routes.home().link,
44-
"isActive": route.name === "home"
45-
},
46-
{
47-
"text": "Mui playground",
48-
"linkProps": routes.mui().link,
49-
"isActive": route.name === "mui"
50-
}
51-
]}
52-
/>
37+
<GdprStoreProvider>
38+
<ConsentBanner gdprPageLink="/mui" siteName='Next Test App' services={[
39+
{
40+
name: "matomo",
41+
title: "Matomo",
42+
description: "User tracking",
43+
}
44+
]} />
5345
<div style={{
54-
"flex": 1,
55-
"margin": "auto",
56-
"maxWidth": 1000,
57-
...fr.spacing("padding", { "topBottom": "10v" })
46+
"height": "100vh",
47+
"display": "flex",
48+
"flexDirection": "column",
5849
}}>
59-
<GdprStoreProvider>
60-
{(() => {
61-
switch (route.name) {
62-
case "mui": return <Mui />;
63-
case "home": return <Home />;
64-
case false: return <h1>404</h1>
65-
}
66-
})()}
67-
</GdprStoreProvider>
50+
<Header
51+
brandTop={<>INTITULE<br />OFFICIEL</>}
52+
serviceTitle="Nom du site / service"
53+
quickAccessItems={[headerFooterDisplayItem]}
54+
homeLinkProps={{ ...routes.home().link, "title": "Accueil - Nom de l’entité (ministère, secrétariat d‘état, gouvernement)" }}
55+
navigation={[
56+
{
57+
"text": "Home",
58+
"linkProps": routes.home().link,
59+
"isActive": route.name === "home"
60+
},
61+
{
62+
"text": "Mui playground",
63+
"linkProps": routes.mui().link,
64+
"isActive": route.name === "mui"
65+
}
66+
]}
67+
/>
68+
<div style={{
69+
"flex": 1,
70+
"margin": "auto",
71+
"maxWidth": 1000,
72+
...fr.spacing("padding", { "topBottom": "10v" })
73+
}}>
74+
{(() => {
75+
switch (route.name) {
76+
case "mui": return <Mui />;
77+
case "home": return <Home />;
78+
case false: return <h1>404</h1>
79+
}
80+
})()}
81+
</div>
82+
<Display />
6883
</div>
69-
<Display />
70-
</div>
84+
</GdprStoreProvider>
7185
);
7286

7387

test/integration/next-pagesdir/pages/_app.tsx

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -60,73 +60,75 @@ function App({ Component, pageProps }: AppProps) {
6060
const router = useRouter()
6161

6262
return (
63-
<div
64-
style={{
65-
"height": "100vh",
66-
"display": "flex",
67-
"flexDirection": "column"
68-
}}
69-
>
63+
<>
7064
<ConsentBanner gdprPageLink="/mui" siteName='Next Test App' services={[
71-
{
72-
name: "matomo",
73-
title: "Matomo",
74-
description: "User tracking",
75-
}
76-
]} />
77-
<Header
78-
brandTop={brandTop}
79-
serviceTitle="Nom du site / service"
80-
homeLinkProps={homeLinkProps}
81-
navigation={[
8265
{
83-
"text": "Home",
84-
"linkProps": {
85-
"href": "/"
66+
name: "matomo",
67+
title: "Matomo",
68+
description: "User tracking",
69+
}
70+
]} />
71+
<div
72+
style={{
73+
"height": "100vh",
74+
"display": "flex",
75+
"flexDirection": "column"
76+
}}
77+
>
78+
<Header
79+
brandTop={brandTop}
80+
serviceTitle="Nom du site / service"
81+
homeLinkProps={homeLinkProps}
82+
navigation={[
83+
{
84+
"text": "Home",
85+
"linkProps": {
86+
"href": "/"
87+
},
88+
"isActive": router.asPath === "/"
8689
},
87-
"isActive": router.asPath === "/"
88-
},
89-
{
90-
"text": "Mui playground",
91-
"linkProps": {
92-
"href": "/mui"
90+
{
91+
"text": "Mui playground",
92+
"linkProps": {
93+
"href": "/mui"
94+
},
95+
"isActive": router.asPath === "/mui"
9396
},
94-
"isActive": router.asPath === "/mui"
95-
},
96-
{
97-
"text": "External link",
98-
"linkProps": {
99-
"href": "https://example.com"
97+
{
98+
"text": "External link",
99+
"linkProps": {
100+
"href": "https://example.com"
101+
}
100102
}
101-
}
102-
]}
103-
quickAccessItems={[headerFooterDisplayItem]}
104-
/>
105-
<div className={css({
106-
"flex": 1,
107-
"margin": "auto",
108-
"maxWidth": 1000,
109-
...fr.spacing("padding", {
110-
"topBottom": "10v"
111-
})
112-
})}>
113-
<Component {...pageProps} />
103+
]}
104+
quickAccessItems={[headerFooterDisplayItem]}
105+
/>
106+
<div className={css({
107+
"flex": 1,
108+
"margin": "auto",
109+
"maxWidth": 1000,
110+
...fr.spacing("padding", {
111+
"topBottom": "10v"
112+
})
113+
})}>
114+
<Component {...pageProps} />
115+
</div>
116+
<Footer
117+
brandTop={brandTop}
118+
accessibility="fully compliant"
119+
contentDescription={`
120+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
121+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
122+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
123+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
124+
eu fugiat nulla pariatur.
125+
`}
126+
homeLinkProps={homeLinkProps}
127+
bottomItems={[headerFooterDisplayItem]}
128+
/>
129+
<Display />
114130
</div>
115-
<Footer
116-
brandTop={brandTop}
117-
accessibility="fully compliant"
118-
contentDescription={`
119-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
120-
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
121-
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
122-
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
123-
eu fugiat nulla pariatur.
124-
`}
125-
homeLinkProps={homeLinkProps}
126-
bottomItems={[headerFooterDisplayItem]}
127-
/>
128-
<Display />
129-
</div>
131+
</>
130132
);
131133
}
132134

0 commit comments

Comments
 (0)