Skip to content

Commit

Permalink
Only wrap hero image in a link if there is a link target
Browse files Browse the repository at this point in the history
  • Loading branch information
ksen0 committed Jan 15, 2025
1 parent 3b644d2 commit c67e798
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/PageHeader/HomePage.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface Props {
config: CollectionEntry<"homepage">;
}
const { config } = Astro.props;
---

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

{
config.data.heroImages.map((im, i) => (
<a href={im.linkTarget || undefined}>
im.linkTarget ?
<a href={im.linkTarget }>
<Image
containerClass={`relative hero-image-container ${i > 0 ? "hidden" : ""}`}
class={"hero-image"}
Expand All @@ -47,6 +49,15 @@ const { config } = Astro.props;
loading={i > 0 ? "lazy" : "eager"}
/>
</a>
:
<Image
containerClass={`relative hero-image-container ${i > 0 ? "hidden" : ""}`}
class={"hero-image"}
aspectRatio="none"
src={im.image}
alt={im.altText}
loading={i > 0 ? "lazy" : "eager"}
/>
))
}
</div>
Expand Down

0 comments on commit c67e798

Please sign in to comment.