fix: Corrige aria-hidden

pull/2573/head
Benjamin Arias 2023-03-13 10:51:05 +01:00 committed by Jérémy Rialland
parent 4ce78b758d
commit 6ba8a6cc52
3 changed files with 59 additions and 46 deletions

View File

@ -35,7 +35,6 @@ export const InfoIcon = (props: HTMLAttributes<SVGElement>) => (
width={20}
height={20}
xmlns="http://www.w3.org/2000/svg"
aria-hidden
role="img"
>
<path
@ -55,7 +54,6 @@ export const SuccessIcon = (props: HTMLAttributes<SVGElement>) => (
width={20}
height={20}
xmlns="http://www.w3.org/2000/svg"
aria-hidden
role="img"
>
<path
@ -116,7 +114,6 @@ export const ErrorIcon = (props: HTMLAttributes<SVGElement>) => (
height="19"
viewBox="0 0 20 19"
xmlns="http://www.w3.org/2000/svg"
aria-hidden
role="img"
>
<path

View File

@ -67,7 +67,7 @@ export function Message({
) : type === 'error' ? (
<ErrorIcon aria-label={t('Échec')} />
) : type === 'info' ? (
<InfoIcon aria-label={t('Attention')} />
<InfoIcon aria-label={t('Attention, information importante')} />
) : (
<ReturnIcon />
)}

View File

@ -17,52 +17,68 @@ export const BigIndicator = ({ main, subTitle, footnote }: IndicatorProps) => (
<Indicator main={main} subTitle={subTitle} footnote={footnote} />
</Grid>
)
const mappedLevelToLabel = {
mauvais: "Taux d'utilisateurs mécontents",
moyen: "Taux d'utilisateurs ayant un avis neutre",
bien: "Taux d'utilisateurs satisfaits",
'très bien': "Taux d'utilisateurs très satisfaits",
}
const RetoursAsProgress = ({
percentages,
}: {
percentages: Record<SatisfactionLevel, number>
}) => (
<div
className="progress__container"
css={`
width: 100%;
overflow: hidden;
height: 2.5rem;
border-radius: 3px;
margin-top: 1rem;
margin-bottom: 2.5rem;
display: flex;
font-size: 1.8rem;
`}
>
{' '}
{SatisfactionStyle.map(([level, { emoji: emojiStr, color }]) => (
<div
key={level}
css={`
width: ${percentages[level]}%;
background-color: ${color};
display: flex;
align-items: center;
justify-content: center;
`}
>
<Emoji emoji={emojiStr} />
<div
css={`
position: absolute;
margin-top: 4rem;
font-size: 0.7rem;
font-weight: lighter;
`}
>
{Math.round(percentages[level])}%
</div>
</div>
))}
</div>
)
}) => {
const { t } = useTranslation()
return (
<ul
className="progress__container"
css={`
width: 100%;
overflow: hidden;
height: 2.5rem;
border-radius: 3px;
margin-top: 1rem;
margin-bottom: 2.5rem;
display: flex;
font-size: 1.8rem;
padding: 0;
`}
>
{' '}
{SatisfactionStyle.map(([level, { emoji: emojiStr, color }]) => {
return (
<li
key={level}
css={`
width: ${percentages[level]}%;
background-color: ${color};
display: flex;
align-items: center;
justify-content: center;
`}
>
<Emoji
emoji={emojiStr}
aria-hidden={false}
alt={t(mappedLevelToLabel[level])}
/>
<div
css={`
position: absolute;
margin-top: 4rem;
font-size: 0.7rem;
font-weight: lighter;
`}
>
{Math.round(percentages[level])}%
</div>
</li>
)
})}
</ul>
)
}
export default function GlobalStats({ stats }: { stats: StatsStruct }) {
const { i18n } = useTranslation()