Skip to content

Commit 48e2ab1

Browse files
committed
Enable to customize license in footer
1 parent faccdc9 commit 48e2ab1

File tree

2 files changed

+50
-7
lines changed

2 files changed

+50
-7
lines changed

src/Footer.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export type FooterProps = {
3434
/** Textual alternative of the image, it MUST include the text present in the image*/
3535
alt: string;
3636
};
37+
license?: ReactNode;
3738
classes?: Partial<
3839
Record<
3940
| "root"
@@ -97,6 +98,7 @@ export const Footer = memo(
9798
cookiesManagementLinkProps,
9899
bottomItems = [],
99100
operatorLogo,
101+
license,
100102
...rest
101103
} = props;
102104

@@ -285,13 +287,19 @@ export const Footer = memo(
285287
</ul>
286288
<div className={cx(fr.cx("fr-footer__bottom-copy"), classes.bottomCopy)}>
287289
<p>
288-
{t("license mention")}{" "}
289-
<a
290-
href="https://github.com/etalab/licence-ouverte/blob/master/LO.md"
291-
target="_blank"
292-
>
293-
{t("etalab license")}{" "}
294-
</a>{" "}
290+
{license === undefined ? (
291+
<>
292+
{t("license mention")}{" "}
293+
<a
294+
href="https://github.com/etalab/licence-ouverte/blob/master/LO.md"
295+
target="_blank"
296+
>
297+
{t("etalab license")}{" "}
298+
</a>{" "}
299+
</>
300+
) : (
301+
license
302+
)}
295303
</p>
296304
</div>
297305
</div>

stories/Footer.stories.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ const { meta, getStory } = getStoryFactory({
5353
"bottomItems": {
5454
"description":
5555
"To integrate the Dark mode switch head over to the documentation of the [Display component](https://react-dsfr-components.etalab.studio/?path=/docs/components-display)"
56+
},
57+
"license": {
58+
"description":
59+
"By default it's Etalab v2. [You can provide a custom React node](#with-custom-license)"
5660
}
5761
}
5862
});
@@ -149,3 +153,34 @@ export const FooterWithHorizontalOperatorLogo = getStory({
149153
"alt": "[À MODIFIER - texte alternatif de l’image]"
150154
}
151155
});
156+
157+
export const WithCustomLicense = getStory({
158+
"brandTop": (
159+
<>
160+
INTITULE
161+
<br />
162+
OFFICIEL
163+
</>
164+
),
165+
"accessibility": "fully compliant",
166+
"contentDescription": `
167+
Ce message est à remplacer par les informations de votre site.
168+
169+
Comme exemple de contenu, vous pouvez indiquer les informations
170+
suivantes : Le site officiel d’information administrative pour les entreprises.
171+
Retrouvez toutes les informations et démarches administratives nécessaires à la création,
172+
à la gestion et au développement de votre entreprise.
173+
`,
174+
"homeLinkProps": {
175+
"href": "/",
176+
"title": "Accueil - Nom de l’entité (ministère, secrétariat d‘état, gouvernement)"
177+
},
178+
"license": (
179+
<>
180+
Unless stated otherwise all content of this website are under{" "}
181+
<a href="https://github.com/codegouvfr/react-dsfr/blob/main/LICENSE" target="_blank">
182+
licence MIT
183+
</a>{" "}
184+
</>
185+
)
186+
});

0 commit comments

Comments
 (0)