forked from codegouvfr/eleventy-dsfr
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% if not alert %}{% set alert = params %}{% endif %} | ||
<div class="fr-alert {% if alert.type %}fr-alert--{{ alert.type }}{% else %}fr-alert--info{% endif %} {% if not alert.title %}fr-alert--sm{% endif %}"> | ||
{% if alert.title %} | ||
<h3 class="fr-alert__title">{{ alert.title | safe }}</h3> | ||
{% endif %} | ||
{% if alert.description %}{{ alert.description | safe }}{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: Alerte | ||
description: Comment intégrer une alerte dans une page du site ? | ||
date: git Last Modified | ||
tags: | ||
- DSFR | ||
- composant | ||
--- | ||
|
||
Ce composant peut être inclus dans un fichier Nunjucks `.njk` ou Markdown `.md`. | ||
|
||
## Utilisation | ||
|
||
### Exemple d'utilisation dans un fichier Markdown `.md` | ||
|
||
```md | ||
:::info Test d'alerte | ||
Contenu **Mardown** | ||
::: | ||
``` | ||
|
||
### Exemple d'utilisation dans un fichier Nunjucks `.njk` | ||
|
||
```njk | ||
{% raw %} | ||
{% from "components/component.njk" import component with context %} | ||
{{ component("alert", { | ||
type: "info", | ||
title: "Test d'alerte", | ||
description: "<p>Le contenu de l'alerte</p>" | ||
}) }} | ||
{% endraw %} | ||
``` | ||
|
||
**Notes :** | ||
|
||
Le composant alerte n'inclut pas de bouton de fermeture. | ||
|
||
Le bloc ne porte pas l'attribut `role="alert"` car il n’apparait pas dynamiquement en cours de navigation. | ||
|
||
Les types possibles sont `info`, `warning`, `error`, `success`. En `njk` si le type est omis, le type `info` sera appliqué. | ||
|
||
## Rendu | ||
|
||
:::info Titre de l'information | ||
Contenu de l'alerte | ||
::: | ||
|
||
{% from "components/component.njk" import component with context %} | ||
{{ component("alert", { | ||
type: "warning", | ||
title: "Titre de l'avertissement", | ||
description: "<p>Le contenu de l'alerte</p>" | ||
}) }} | ||
|
||
:::success | ||
Contenu de l'alerte seule | ||
::: | ||
|
||
{% from "components/component.njk" import component with context %} | ||
{{ component("alert", { | ||
type: "error", | ||
title: "Titre d'une erreur simple" | ||
}) }} | ||
|
||
<br> | ||
|
||
[Voir aussi la page du composant sur le site du DSFR](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/alerte){.fr-link .fr-fi-arrow-right-line .fr-link--icon-right} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters