@@ -4,6 +4,9 @@ import Tag from "../ui/Tag.astro";
44import ReadMore from " ../ui/ReadMore.astro" ;
55import Capsule from " ../ui/Capsule.astro" ;
66import DatePub from " ./DatePub.astro" ;
7+ import { Image } from " astro:assets" ;
8+ import getReadingTime from " reading-time" ;
9+ import { Icon } from " astro-icon/components" ;
710
811const currentPath = Astro .url .pathname ;
912const urlParts = currentPath .split (" /" ).filter (Boolean );
@@ -36,24 +39,35 @@ const getPostUrl = (post: CollectionEntry<"blog">) => {
3639 const cleanSlug = slugParts .join (" /" );
3740 return ` /${currentLang }/blog/posts/${cleanSlug } ` ;
3841};
42+
43+ const readingTimeValue = latestPost ? Math .ceil (getReadingTime (latestPost .body ).minutes ) : 0 ;
44+ const readingTimeLabel = currentLang === " en" ? " min read" : " min de lectura" ;
3945---
4046
4147{
4248 latestPost && (
4349 <div
44- style = { { backgroundImage: ` url(${image }) ` }}
45- class = " h-full hover:shadow-[0_20px_50px_rgba(13,188,130,0.2)] flex flex-col overflow-hidden rounded-2xl bg-linear-to-br bg-center bg-cover transition-all ease-in-out duration-200"
50+ class = " h-full hover:shadow-[0_20px_50px_rgba(13,188,130,0.2)] relative flex flex-col overflow-hidden rounded-2xl transition-all ease-in-out duration-200 group/last"
4651 role = " article"
4752 aria-labelledby = " post-title"
4853 >
49- <article class = " h-full flex flex-col justify-between max-sm:bg-zinc-900 max-sm:relative sm:bg-linear-to-t from-black/95 from-25% to-transparent max-sm:from-60% p-8 max-md:p-6 max-sm:mp-0 max-sm:p-0" >
54+ <div class = " absolute inset-0 z-0" >
55+ <Image
56+ src = { image }
57+ alt = { imageAlt }
58+ width = { 1200 }
59+ height = { 675 }
60+ class = " w-full h-full object-cover transition-transform duration-500 group-hover/last:scale-105"
61+ />
62+ </div >
63+ <article class = " h-full relative flex flex-col justify-between max-sm:bg-zinc-900/80 sm:bg-linear-to-t from-black/95 from-25% to-transparent max-sm:from-60% p-8 max-md:p-6 max-sm:mp-0 max-sm:p-0 z-10 backdrop-blur-[2px] sm:backdrop-blur-none" >
5064 <a
5165 href = { getPostUrl (latestPost )}
5266 class = " sm:hidden relative top-0 left-0 w-full h-auto -z-0"
5367 aria-hidden = " true"
5468 tabindex = " -1"
5569 >
56- <img src = { image } alt = { imageAlt } class = " w-full h-auto" loading = " lazy" />
70+ <Image src = { image } alt = { imageAlt } width = { 800 } height = { 450 } class = " w-full h-auto" loading = " lazy" />
5771 </a >
5872 <div
5973 class = " w-full flex pb-5 gap-2 flex-wrap justify-end z-10 max-sm:px-6 max-sm:pt-6"
@@ -70,8 +84,14 @@ const getPostUrl = (post: CollectionEntry<"blog">) => {
7084 class = " text-mint-50 gap-3 h-full flex items-end max-sm:px-6 rounded-lg transition-all"
7185 aria-label = { ` Read article: ${latestPost .data .title } ` }
7286 >
73- <div class = " gap-3 flex flex-col justify-end drop-shadow-[1px_6px_1px_rgba(0,0,0,0.3)]" >
74- <DatePub date = { latestPost .data .pubDate } class = " text-mint-50" />
87+ <div class = " gap-3 flex flex-col justify-end drop-shadow-[1px_6px_1px_rgba(0,0,0,0.5)]" >
88+ <div class = " flex items-center gap-4 text-mint-100 font-medium" >
89+ <DatePub date = { latestPost .data .pubDate } />
90+ <span class = " flex items-center gap-1 text-sm" >
91+ <Icon name = " clock" class = " size-4" />
92+ { readingTimeValue } { readingTimeLabel }
93+ </span >
94+ </div >
7595 <h2 id = " post-title" class = " text-4xl max-xl:text-3xl max-sm:text-2xl font-bold" >
7696 <span >{ latestPost .data .title } </span >
7797 </h2 >
0 commit comments