Skip to content

Commit b6c9276

Browse files
authored
Merge pull request #10 from AndyWang505/feature/ux-enhancements
fix: correct hardcoded cover width in CardItem component for consiste…
2 parents 8257c78 + c9dc245 commit b6c9276

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/components/CardItem.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ function getReadingTime(wordCount: number): number {
5353
const wordCount = content ? getWordCount(content) : getWordCount(description);
5454
const readingTime = getReadingTime(wordCount);
5555
const hasCover = heroImage !== undefined && heroImage !== null && heroImage !== "";
56-
const coverWidth = "30%";
5756
---
5857

5958
<div class="w-full rounded-xl overflow-hidden relative mb-4 bg-white
@@ -77,7 +76,7 @@ const coverWidth = "30%";
7776
</a>
7877
}
7978

80-
<div class={`px-4 py-4 md:pl-9 md:pr-2 md:pt-7 md:pb-6 relative ${hasCover ? `md:w-[calc(100%_-_${coverWidth}_-_12px)]` : 'md:w-[calc(100%_-_52px_-_12px)]'}`}>
79+
<div class={`px-4 py-4 md:pl-9 md:pr-2 md:pt-7 md:pb-6 relative ${hasCover ? 'md:w-[calc(100%_-_30%_-_12px)]' : 'md:w-[calc(100%_-_52px_-_12px)]'}`}>
8180
<a href={`/post/${slug}/`}
8281
class="group w-full block font-bold mb-2 md:mb-3 text-lg md:text-3xl
8382
text-zinc-900 dark:text-zinc-100
@@ -175,7 +174,7 @@ const coverWidth = "30%";
175174
<!-- Desktop images -->
176175
{hasCover &&
177176
<a href={`/post/${slug}/`}
178-
class={`group hidden md:block md:w-[${coverWidth}] relative md:absolute md:top-3 md:bottom-3 md:right-3 rounded-xl overflow-hidden active:scale-95 transition-transform ease-out`}>
177+
class="group hidden md:block md:w-[30%] relative md:absolute md:top-3 md:bottom-3 md:right-3 rounded-xl overflow-hidden active:scale-95 transition-transform ease-out">
179178
<div class="absolute pointer-events-none z-10 w-full h-full group-hover:bg-black/30 group-active:bg-black/50 transition-colors duration-300 ease-out"></div>
180179
<div class="absolute pointer-events-none z-20 w-full h-full flex items-center justify-center">
181180
<svg class="opacity-0 group-hover:opacity-100 scale-50 group-hover:scale-100 text-white text-5xl transition-all" width="60" height="60" viewBox="0 0 24 24" fill="currentColor">

0 commit comments

Comments
 (0)