File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ type Props = ComponentProps<typeof Image> & {
5
5
/** Defaults to 'photo' aspect ratio */
6
6
aspectRatio? : " photo" | " square" | " none" ;
7
7
caption? : string ;
8
+ containerClass? : string ;
8
9
};
9
10
const { props } = Astro ;
10
11
---
11
12
12
- <div class =" relative w-fit h-fit" >
13
+ <div class ={ props . containerClass || " relative w-fit h-fit" } >
13
14
<!-- The props are identical but the lack of "IntrinsicAttributes" gives an errant ts error -->
14
15
<!-- @ts-ignore -->
15
16
<Image
Original file line number Diff line number Diff line change 1
1
---
2
+ import Image from " @components/Image/index.astro" ;
2
3
import type { CollectionEntry } from " astro:content" ;
3
4
import { Icon } from " ../Icon" ;
4
5
@@ -32,20 +33,14 @@ const { config } = Astro.props;
32
33
33
34
{
34
35
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
+ />
49
44
))
50
45
}
51
46
</div >
@@ -56,7 +51,6 @@ const { config } = Astro.props;
56
51
const images = document.querySelectorAll(".hero-image-container");
57
52
if (images.length > 1) {
58
53
const shownImageInd = Math.round(Math.random() * (images.length - 1));
59
- console.log(shownImageInd);
60
54
// hide the default one
61
55
images[0].classList.add("hidden");
62
56
// show a random one
You can’t perform that action at this time.
0 commit comments