refactor(SW-302): code cleanup

This commit is contained in:
Matilda Landström
2024-09-19 13:26:05 +02:00
parent 2438d04f43
commit 72c961eabf
9 changed files with 65 additions and 37 deletions

View File

@@ -15,10 +15,16 @@ export default function CardImage({
<article className={`${styles.container} ${className}`}>
<div className={styles.imageContainer}>
{imageCards.map(
({ backgroundImage }) =>
({ backgroundImage }, idx: Number) =>
backgroundImage && (
<Image
key={backgroundImage.title}
key={
(backgroundImage.title &&
`${backgroundImage.title}-${idx}`) ||
(backgroundImage.meta.caption &&
`${backgroundImage.meta.caption}-${idx}`) ||
backgroundImage.url
}
src={backgroundImage.url}
className={styles.image}
alt={backgroundImage.title}