Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/code-du-travail-frontend/src/modules/stats/Resume.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Tile } from "@codegouvfr/react-dsfr/Tile";
import { toUrl } from "../utils/url";

export const Resume = ({
year,
fileName,
fileSizeMb,
}: {
year: number;
fileName: string;
fileSizeMb: number;
}) => (
<Tile
downloadButton
enlargeLinkOrButton
imageSvg={false}
small
imageUrl={`/static/assets/img/modeles-de-courriers-download.svg`}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR - Potential typo: The filename contains 'modeles-de-courriers-download.svg' with 'courriers' (plural). Verify if this should be 'courrier' (singular) to match French grammar conventions, as 'modèle de courrier' is the standard form.

Suggested change
imageUrl={`/static/assets/img/modeles-de-courriers-download.svg`}
imageUrl={`/static/assets/img/modeles-de-courrier-download.svg`}

title={`Télécharger le bilan annuel de l’année ${year}`}
titleAs={`h3`}
detail={<p>Format PDF - {fileSizeMb}Mo</p>}
imageAlt={""}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL - Accessibility violation: Empty imageAlt prop fails WCAG accessibility standards. All images must have meaningful alternative text for screen readers. Consider using a descriptive alt text like 'Icône de téléchargement de document PDF' or make this decorative by using aria-hidden="true" on the image if the download context is already clear from the title.

Suggested change
imageAlt={""}
imageAlt={"Icône de téléchargement de document PDF"}

linkProps={{
href: toUrl(fileName),
}}
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,65 @@ exports[`<Stats /> should match snapshot 1`] = `
>
Statistiques d’utilisation depuis le 01/01/2020
</p>
<h2
class="fr-mt-6w fr-h3"
>
Bilans annuels
</h2>
<div
class="fr-mt-6w fr-grid-row fr-grid-row--gutters"
>
<div
class="fr-col-12 fr-col-lg-3"
>
<div
class="fr-tile fr-enlarge-link fr-tile--vertical fr-tile--sm fr-tile--download"
id="fr-tile-:r4:"
>
<div
class="fr-tile__body"
>
<div
class="fr-tile__content"
>
<h3
class="fr-tile__title"
>
<a
aria-disabled="false"
class=""
href="bucket.url/preview/default/cdtn_bilan_2024.pdf"
>
Télécharger le bilan annuel de l’année 2024
</a>
</h3>
<div
class="fr-tile__detail"
>
<p>
Format PDF -
1
Mo
</p>
</div>
</div>
</div>
<div
class="fr-tile__header"
>
<div
class="fr-tile__img"
>
<img
alt=""
class="fr-responsive-img"
src="/static/assets/img/modeles-de-courriers-download.svg"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions packages/code-du-travail-frontend/src/modules/stats/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fr } from "@codegouvfr/react-dsfr";
import { StatsDisplay } from "./StatsDisplay";
import { Resume } from "./Resume";
import { css } from "@styled-system/css";

type StatsProps = {
Expand Down Expand Up @@ -35,6 +36,12 @@ export const Stats = (props: StatsProps) => (
<p className={fr.cx("fr-mt-6w")}>
Statistiques d’utilisation depuis le 01/01/2020
</p>
<h2 className={fr.cx("fr-mt-6w", "fr-h3")}>Bilans annuels</h2>
<div className={fr.cx("fr-mt-6w", "fr-grid-row", "fr-grid-row--gutters")}>
<div className={fr.cx("fr-col-12", "fr-col-lg-3")}>
<Resume fileName={"cdtn_bilan_2024.pdf"} year={2024} fileSizeMb={1} />
</div>
</div>
</div>
</div>
);
Expand Down