aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/layout/card.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-06-07 17:44:17 +0200
committerGitHub <noreply@github.com>2022-06-07 17:44:17 +0200
commita640a5dee88f82398111142d6a4ca089bf0924cb (patch)
tree3e786789f8dfdb42d9e524171d2dfa5812c1fff0 /src/components/molecules/layout/card.tsx
parent22eeede34778d8e903a1999bfc6bc715c361d9ce (diff)
parentb1103a9554c5593c065466d1e289db2680cf2993 (diff)
chore: improve accessibility (#20)
Improve images, code blocks, cards and progress bar accessibility.
Diffstat (limited to 'src/components/molecules/layout/card.tsx')
-rw-r--r--src/components/molecules/layout/card.tsx14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/components/molecules/layout/card.tsx b/src/components/molecules/layout/card.tsx
index 7bbd040..c48bc18 100644
--- a/src/components/molecules/layout/card.tsx
+++ b/src/components/molecules/layout/card.tsx
@@ -22,6 +22,10 @@ export type CardProps = {
*/
coverFit?: ResponsiveImageProps['objectFit'];
/**
+ * The card id.
+ */
+ id: string;
+ /**
* The card meta.
*/
meta?: MetaData;
@@ -52,6 +56,7 @@ const Card: FC<CardProps> = ({
className = '',
cover,
coverFit = 'cover',
+ id,
meta,
tagline,
title,
@@ -59,7 +64,11 @@ const Card: FC<CardProps> = ({
url,
}) => {
return (
- <ButtonLink target={url} className={`${styles.wrapper} ${className}`}>
+ <ButtonLink
+ aria-labelledby={`${id}-heading`}
+ target={url}
+ className={`${styles.wrapper} ${className}`}
+ >
<article className={styles.article}>
<header className={styles.header}>
{cover && (
@@ -71,8 +80,9 @@ const Card: FC<CardProps> = ({
)}
<Heading
alignment="center"
- level={titleLevel}
className={styles.title}
+ id={`${id}-heading`}
+ level={titleLevel}
>
{title}
</Heading>