Skip to content

Commit 6ae7670

Browse files
update Image to use single component for picture and make div a figure instead of a div
1 parent a781945 commit 6ae7670

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

dotcom-rendering/src/components/ProductCardImage.tsx

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@ export const ProductCardImage = ({
2020
return null;
2121
}
2222

23+
const ProductPicture = () => (
24+
<Picture
25+
role={'productCard'}
26+
format={format}
27+
master={image.url}
28+
alt={image.alt}
29+
height={image.height}
30+
width={image.width}
31+
loading={'eager'}
32+
/>
33+
);
34+
2335
return (
24-
<div>
36+
<figure>
2537
{url ? (
2638
<a
2739
href={url}
@@ -36,33 +48,17 @@ export const ProductCardImage = ({
3648
}
3749
`}
3850
>
39-
<Picture
40-
role={'productCard'}
41-
format={format}
42-
master={image.url}
43-
alt={image.alt}
44-
height={image.height}
45-
width={image.width}
46-
loading={'eager'}
47-
/>
51+
<ProductPicture />
4852
</a>
4953
) : (
50-
<Picture
51-
role={'productCard'}
52-
format={format}
53-
master={image.url}
54-
alt={image.alt}
55-
height={image.height}
56-
width={image.width}
57-
loading={'eager'}
58-
/>
54+
<ProductPicture />
5955
)}
6056
<Caption
6157
format={format}
6258
displayCredit={image.displayCredit}
6359
credit={image.credit}
6460
isOverlaid={false}
6561
/>
66-
</div>
62+
</figure>
6763
);
6864
};

0 commit comments

Comments
 (0)