File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ type Props = ComponentProps<typeof Image> & {
55 /** Defaults to 'photo' aspect ratio */
66 aspectRatio? : " photo" | " square" | " none" ;
77 caption? : string ;
8+ containerClass? : string ;
89};
910const { props } = Astro ;
1011---
1112
12- <div class =" relative w-fit h-fit" >
13+ <div class ={ props . containerClass || " relative w-fit h-fit" } >
1314 <!-- The props are identical but the lack of "IntrinsicAttributes" gives an errant ts error -->
1415 <!-- @ts-ignore -->
1516 <Image
Original file line number Diff line number Diff line change 11---
2+ import Image from " @components/Image/index.astro" ;
23import type { CollectionEntry } from " astro:content" ;
34import { Icon } from " ../Icon" ;
45
@@ -32,20 +33,14 @@ const { config } = Astro.props;
3233
3334 {
3435 config .data .heroImages .map ((im , i ) => (
35- <div class = { ` relative hero-image-container ${i > 0 ? " hidden" : " " } ` } >
36- <img
37- class = { " hero-image" }
38- src = { im .image .src }
39- alt = { im .altText }
40- loading = { i > 0 ? " lazy" : " eager" }
41- />
42- <p
43- aria-hidden
44- class = { " renderable-alt bg-bg-gray-40 line-clamp-3 absolute top-0 mt-sm mx-sm px-[7.5px] pb-[2.5px] rounded-xl text-body-caption text-ellipsis" }
45- >
46- { im .altText }
47- </p >
48- </div >
36+ <Image
37+ containerClass = { ` relative hero-image-container ${i > 0 ? " hidden" : " " } ` }
38+ class = { " hero-image" }
39+ aspectRatio = " none"
40+ src = { im .image }
41+ alt = { im .altText }
42+ loading = { i > 0 ? " lazy" : " eager" }
43+ />
4944 ))
5045 }
5146</div >
@@ -56,7 +51,6 @@ const { config } = Astro.props;
5651 const images = document.querySelectorAll(".hero-image-container");
5752 if (images.length > 1) {
5853 const shownImageInd = Math.round(Math.random() * (images.length - 1));
59- console.log(shownImageInd);
6054 // hide the default one
6155 images[0].classList.add("hidden");
6256 // show a random one
You can’t perform that action at this time.
0 commit comments