File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
2+ import { Image } from " astro:assets" ;
3+
24interface Props {
35 title: string ;
46 category: string ;
@@ -28,12 +30,15 @@ const colorClass = categoryColors[category] || "bg-gray-500";
2830 class =" bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-2xl transition-all duration-300 hover:-translate-y-1"
2931>
3032 <div class =" relative h-48 overflow-hidden" >
31- <img
33+ <Image
3234 src ={ image }
3335 alt ={ title }
3436 class =" w-full h-full object-cover"
3537 loading =" lazy"
3638 decoding =" async"
39+ width ={ 400 }
40+ height ={ 300 }
41+ format =" webp"
3742 />
3843 <span
3944 class ={ ` absolute top-4 right-4 ${colorClass } text-white px-3 py-1 rounded-full text-sm font-semibold ` }
Original file line number Diff line number Diff line change 22import Layout from " ../layouts/Layout.astro" ;
33import Navigation from " ../components/Navigation.astro" ;
44import Footer from " ../components/Footer.astro" ;
5+ import { Image } from " astro:assets" ;
56---
67
78<Layout
@@ -48,12 +49,15 @@ import Footer from "../components/Footer.astro";
4849 </p >
4950 </div >
5051 <div class =" relative" >
51- <img
52+ <Image
5253 src =" https://images.unsplash.com/photo-1581091226825-a6a2a5aee158?w=800&h=600&fit=crop"
5354 alt =" Makers working together"
5455 class =" rounded-2xl shadow-2xl"
5556 loading =" lazy"
5657 decoding =" async"
58+ width ={ 800 }
59+ height ={ 600 }
60+ format =" webp"
5761 />
5862 </div >
5963 </div >
Original file line number Diff line number Diff line change 22import Layout from " ../../layouts/Layout.astro" ;
33import Navigation from " ../../components/Navigation.astro" ;
44import Footer from " ../../components/Footer.astro" ;
5+ import { Image } from " astro:assets" ;
56---
67
78<Layout
@@ -45,12 +46,15 @@ import Footer from "../../components/Footer.astro";
4546 </div >
4647
4748 <!-- Featured Image -->
48- <img
49+ <Image
4950 src =" https://images.unsplash.com/photo-1553406830-ef2513450d76?w=1200&h=600&fit=crop"
5051 alt =" Arduino Board"
5152 class =" w-full rounded-2xl shadow-2xl mb-12"
5253 loading =" lazy"
5354 decoding =" async"
55+ width ={ 1200 }
56+ height ={ 600 }
57+ format =" webp"
5458 />
5559
5660 <!-- Article Content -->
Original file line number Diff line number Diff line change 22import Layout from " ../../layouts/Layout.astro" ;
33import Navigation from " ../../components/Navigation.astro" ;
44import Footer from " ../../components/Footer.astro" ;
5+ import { Image } from " astro:assets" ;
56
67const blogPosts = [
78 {
@@ -179,12 +180,15 @@ const blogPosts = [
179180 >
180181 <div class =" md:flex" >
181182 <div class =" md:w-1/2" >
182- <img
183+ <Image
183184 src ={ blogPosts [0 ].image }
184185 alt ={ blogPosts [0 ].title }
185186 class =" w-full h-64 md:h-full object-cover"
186187 loading =" lazy"
187188 decoding =" async"
189+ width ={ 600 }
190+ height ={ 400 }
191+ format =" webp"
188192 />
189193 </div >
190194 <div class =" md:w-1/2 p-8" >
@@ -244,12 +248,15 @@ const blogPosts = [
244248 {
245249 blogPosts .slice (1 ).map ((post ) => (
246250 <article class = " bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-2xl transition-all hover:-translate-y-1" >
247- <img
251+ <Image
248252 src = { post .image }
249253 alt = { post .title }
250254 class = " w-full h-48 object-cover"
251255 loading = " lazy"
252256 decoding = " async"
257+ width = { 400 }
258+ height = { 300 }
259+ format = " webp"
253260 />
254261 <div class = " p-6" >
255262 <div class = " flex items-center space-x-4 mb-3" >
Original file line number Diff line number Diff line change 22import Layout from " ../layouts/Layout.astro" ;
33import Navigation from " ../components/Navigation.astro" ;
44import Footer from " ../components/Footer.astro" ;
5+ import { Image } from " astro:assets" ;
56---
67
78<Layout
@@ -64,12 +65,15 @@ import Footer from "../components/Footer.astro";
6465 </ul >
6566 </div >
6667 <div class =" relative" >
67- <img
68+ <Image
6869 src =" https://images.unsplash.com/photo-1559027615-cd4628902d4a?w=800&h=600&fit=crop"
6970 alt =" Community making together"
7071 loading =" lazy"
7172 decoding =" async"
7273 class =" rounded-2xl shadow-2xl"
74+ width ={ 800 }
75+ height ={ 600 }
76+ format =" webp"
7377 />
7478 </div >
7579 </div >
Original file line number Diff line number Diff line change 22import Layout from " ../layouts/Layout.astro" ;
33import Navigation from " ../components/Navigation.astro" ;
44import Footer from " ../components/Footer.astro" ;
5+ import { Image } from " astro:assets" ;
56
67const products = [
78 {
@@ -173,12 +174,15 @@ const products = [
173174 products .map ((product ) => (
174175 <article class = " bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-2xl transition-all hover:-translate-y-1" >
175176 <div class = " relative h-64 overflow-hidden" >
176- <img
177+ <Image
177178 src = { product .image }
178179 alt = { product .name }
179180 class = " w-full h-full object-cover"
180181 loading = " lazy"
181182 decoding = " async"
183+ width = { 400 }
184+ height = { 300 }
185+ format = " webp"
182186 />
183187 <div class = " absolute top-4 right-4 bg-green-500 text-white px-3 py-1 rounded-full text-sm font-semibold" >
184188 ${ product .price }
@@ -298,12 +302,15 @@ const products = [
298302 </div >
299303 </div >
300304 <div class =" relative" >
301- <img
305+ <Image
302306 src =" https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=800&h=600&fit=crop"
303307 alt =" MakerFriends community"
304308 class =" rounded-2xl shadow-2xl"
305309 loading =" lazy"
306310 decoding =" async"
311+ width ={ 800 }
312+ height ={ 600 }
313+ format =" webp"
307314 />
308315 </div >
309316 </div >
You can’t perform that action at this time.
0 commit comments