Skip to content

Commit faf59c3

Browse files
committed
Permettre l'ajout d'un bandeau d'information
1 parent 9c026ca commit faf59c3

File tree

5 files changed

+66
-4
lines changed

5 files changed

+66
-4
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Several environment variables can be used to tailor the theme to your needs:
2929
DSFR_THEME_HOME_URL
3030
DSFR_THEME_SERVICE_TITLE
3131
DSFR_THEME_BRAND_TOP
32+
DSFR_NOTICE_TITLE
33+
DSFR_NOTICE_DESCRIPTION
34+
DSFR_NOTICE_SEVERITY
3235
```
3336

3437
These variables should be made available to the process running Keycloak on your server.
@@ -44,6 +47,12 @@ If you are deploying Keycloak on Kubernetes using Helm, here's how to configure
4447
value: CodeGouv
4548
- name: DSFR_THEME_BRAND_TOP
4649
value: "République<br/>Française"
50+
- name: DSFR_NOTICE_TITLE
51+
value: Title
52+
- name: DSFR_NOTICE_DESCRIPTION
53+
value: Description
54+
- name: DSFR_NOTICE_SEVERITY
55+
value: info
4756
...
4857
```
4958

src/account/Template.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Header as DsfrHeader } from "@codegouvfr/react-dsfr/Header";
1313
import { Footer as DsfrFooter } from "@codegouvfr/react-dsfr/Footer";
1414
import { SideMenu } from "@codegouvfr/react-dsfr/SideMenu";
1515
import { Alert } from "@codegouvfr/react-dsfr/Alert";
16+
import { Notice } from "@codegouvfr/react-dsfr/Notice";
1617
import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
1718
import { fr } from "@codegouvfr/react-dsfr";
1819
import { getColorScheme } from "../shared/getColorScheme";
@@ -83,6 +84,26 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
8384
]}
8485
/>
8586

87+
{(kcContext.properties?.DSFR_NOTICE_TITLE || kcContext.properties?.DSFR_NOTICE_DESCRIPTION) && (
88+
<Notice
89+
severity={(kcContext.properties.DSFR_NOTICE_SEVERITY as any) || "info"}
90+
title={
91+
<span
92+
dangerouslySetInnerHTML={{
93+
__html: kcContext.properties.DSFR_NOTICE_TITLE
94+
}}
95+
/>
96+
}
97+
description={
98+
<span
99+
dangerouslySetInnerHTML={{
100+
__html: kcContext.properties.DSFR_NOTICE_DESCRIPTION
101+
}}
102+
/>
103+
}
104+
/>
105+
)}
106+
86107
<div
87108
className={fr.cx("fr-container")}
88109
style={{

src/kc.gen.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is auto-generated by the `update-kc-gen` command. Do not edit it manually.
2-
// Hash: 3b508e89452af5c2abfd702000cd0e56db6739ec9016997d6b32b8ac1f39195d
2+
// Hash: 415229e332a814cae52152aa8f2b43dab69ceadc6ed220a115d8a8349abbde0b
33

44
/* eslint-disable */
55

@@ -16,18 +16,27 @@ export const themeNames: ThemeName[] = ["DSFR"];
1616
export type KcEnvName =
1717
| "DSFR_THEME_HOME_URL"
1818
| "DSFR_THEME_SERVICE_TITLE"
19-
| "DSFR_THEME_BRAND_TOP";
19+
| "DSFR_THEME_BRAND_TOP"
20+
| "DSFR_NOTICE_TITLE"
21+
| "DSFR_NOTICE_DESCRIPTION"
22+
| "DSFR_NOTICE_SEVERITY";
2023

2124
export const kcEnvNames: KcEnvName[] = [
2225
"DSFR_THEME_HOME_URL",
2326
"DSFR_THEME_SERVICE_TITLE",
24-
"DSFR_THEME_BRAND_TOP"
27+
"DSFR_THEME_BRAND_TOP",
28+
"DSFR_NOTICE_TITLE",
29+
"DSFR_NOTICE_DESCRIPTION",
30+
"DSFR_NOTICE_SEVERITY"
2531
];
2632

2733
export const kcEnvDefaults: Record<KcEnvName, string> = {
2834
DSFR_THEME_HOME_URL: "",
2935
DSFR_THEME_SERVICE_TITLE: "",
30-
DSFR_THEME_BRAND_TOP: "République<br/>Française"
36+
DSFR_THEME_BRAND_TOP: "République<br/>Française",
37+
DSFR_NOTICE_TITLE: "Mon super titre",
38+
DSFR_NOTICE_DESCRIPTION: "Ma super description",
39+
DSFR_NOTICE_SEVERITY: "info"
3140
};
3241

3342
/**

src/login/Template.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { redirectUrlOrigin } from "./shared/redirectUrlOrigin";
1212
import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
1313
import { Footer as DSFRFooter } from "@codegouvfr/react-dsfr/Footer";
1414
import { Alert } from "@codegouvfr/react-dsfr/Alert";
15+
import { Notice } from "@codegouvfr/react-dsfr/Notice";
1516
import { fr } from "@codegouvfr/react-dsfr";
1617
import "@codegouvfr/react-dsfr/main.css";
1718
import { startReactDsfr } from "@codegouvfr/react-dsfr/spa";
@@ -90,6 +91,25 @@ export default function Template(props: Props) {
9091
}
9192
/>
9293
<main role="main" id="content">
94+
{(kcContext.properties?.DSFR_NOTICE_TITLE || kcContext.properties?.DSFR_NOTICE_DESCRIPTION) && (
95+
<Notice
96+
severity={(kcContext.properties.DSFR_NOTICE_SEVERITY as any) || "info"}
97+
title={
98+
<span
99+
dangerouslySetInnerHTML={{
100+
__html: kcContext.properties.DSFR_NOTICE_TITLE
101+
}}
102+
/>
103+
}
104+
description={
105+
<span
106+
dangerouslySetInnerHTML={{
107+
__html: kcContext.properties.DSFR_NOTICE_DESCRIPTION
108+
}}
109+
/>
110+
}
111+
/>
112+
)}
93113
<div className={fr.cx("fr-container", "fr-container--fluid", "fr-my-md-14v")}>
94114
<div className={fr.cx("fr-grid-row", "fr-grid-row--gutters", "fr-grid-row--center")}>
95115
<div className={fr.cx("fr-col-12", "fr-col-md-8", "fr-col-lg-6")}>

vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export default defineConfig({
1313
{ name: "DSFR_THEME_HOME_URL", default: "" },
1414
{ name: "DSFR_THEME_SERVICE_TITLE", default: "" },
1515
{ name: "DSFR_THEME_BRAND_TOP", default: "République<br/>Française" },
16+
{ name: "DSFR_NOTICE_TITLE", default: "" },
17+
{ name: "DSFR_NOTICE_DESCRIPTION", default: "" },
18+
{ name: "DSFR_NOTICE_SEVERITY", default: "info" },
1619
]
1720
})
1821
]

0 commit comments

Comments
 (0)