Skip to content

Commit c67e798

Browse files
committed
Only wrap hero image in a link if there is a link target
1 parent 3b644d2 commit c67e798

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/components/PageHeader/HomePage.astro

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface Props {
77
config: CollectionEntry<"homepage">;
88
}
99
const { config } = Astro.props;
10+
1011
---
1112

1213
<div class="px-lg pt-5xl lg:pt-3xl pb-0 h-full">
@@ -37,7 +38,8 @@ const { config } = Astro.props;
3738

3839
{
3940
config.data.heroImages.map((im, i) => (
40-
<a href={im.linkTarget || undefined}>
41+
im.linkTarget ?
42+
<a href={im.linkTarget }>
4143
<Image
4244
containerClass={`relative hero-image-container ${i > 0 ? "hidden" : ""}`}
4345
class={"hero-image"}
@@ -47,6 +49,15 @@ const { config } = Astro.props;
4749
loading={i > 0 ? "lazy" : "eager"}
4850
/>
4951
</a>
52+
:
53+
<Image
54+
containerClass={`relative hero-image-container ${i > 0 ? "hidden" : ""}`}
55+
class={"hero-image"}
56+
aspectRatio="none"
57+
src={im.image}
58+
alt={im.altText}
59+
loading={i > 0 ? "lazy" : "eager"}
60+
/>
5061
))
5162
}
5263
</div>

0 commit comments

Comments
 (0)