1
1
---
2
- import Picture from " ../components/Picture. astro" ;
2
+ import { Image } from " astro:assets " ;
3
3
import PostTags from " ../components/PostTags.astro" ;
4
4
import { formatDate } from " ../helpers/formatDate" ;
5
5
import type { IPostFrontmatter } from " ../helpers/frontmatter" ;
@@ -11,7 +11,7 @@ interface Props {
11
11
}
12
12
13
13
const {
14
- content : { title, description, pubDate, heroImage, url, readingTime, file, tags },
14
+ content : { title, description, pubDate, heroImage, heroImageMetadata, url, readingTime, file, tags },
15
15
} = Astro .props as Props ;
16
16
17
17
const tweetLink = ` https://twitter.com/intent/tweet?url=
@@ -51,13 +51,11 @@ const otherPosts = posts.slice(-3);
51
51
<PostTags tags ={ tags } class =" flex justify-center" />
52
52
</header >
53
53
54
- <Picture
55
- src ={ heroImage }
54
+ <Image
55
+ src ={ heroImageMetadata }
56
56
class =" max-w-full lg:max-w-6xl mx-auto mt-4 mb-6 sm:rounded-md bg-gray-400 dark:bg-slate-700"
57
- widths ={ [400 , 900 ]}
58
57
sizes =" (max-width: 900px) 400px, 900px"
59
58
alt =" Blog Hero Image"
60
- aspectRatio =" 16:9"
61
59
/>
62
60
63
61
<div
@@ -90,14 +88,13 @@ const otherPosts = posts.slice(-3);
90
88
index === otherPosts .length - 1 ? " hidden" : " "
91
89
} ` }
92
90
>
93
- <Picture
94
- src = { post .frontmatter .heroImage }
95
- class = " rounded-md bg-gray-400 dark:bg-slate-700 group-hover:ring-4 group-hover:ring-sky-400 dark:group-hover:ring-sky-500 transition ease-in duration-300"
96
- widths = { [200 ]}
97
- sizes = " (max-width: 900px) 400px, 900px"
98
- alt = " Next Blog Hero Image"
99
- aspectRatio = " 16:9"
100
- />
91
+ <div class = " flex w-52 h-32 rounded-md overflow-hidden" >
92
+ <Image
93
+ src = { post .frontmatter .heroImageMetadata }
94
+ class = " object-fill rounded-md bg-gray-400 dark:bg-slate-700 group-hover:ring-4 group-hover:ring-sky-400 dark:group-hover:ring-sky-500 transition ease-in duration-300"
95
+ alt = " Next Blog Hero Image"
96
+ />
97
+ </div >
101
98
<span class = " block mt-2" >{ post .frontmatter .title } </span >
102
99
</a >
103
100
))
0 commit comments