Skip to content

Commit 4293ae1

Browse files
authored
style: update blog card styling (#65)
1 parent 1a0ed60 commit 4293ae1

2 files changed

Lines changed: 28 additions & 24 deletions

File tree

‎resources/js/components/BlogCard.vue‎

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ const props = defineProps({
99
1010
const formattedDate = computed(() => {
1111
if (!props.blog.created_at) {
12-
return '';
13-
}
12+
return '';
13+
}
1414
1515
const date = new Date(props.blog.created_at);
1616
1717
if (isNaN(date.getTime())) {
18-
return '';
19-
}
18+
return '';
19+
}
2020
2121
return new Intl.DateTimeFormat('en-US', {
2222
month: 'short',
@@ -28,41 +28,42 @@ return '';
2828

2929
<template>
3030
<div
31-
class="group border-slate-150 flex flex-col overflow-hidden rounded-2xl border bg-white shadow-sm transition-all duration-300 hover:-translate-y-1 hover:shadow-md"
31+
class="group flex flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xs transition-all duration-300 hover:-translate-y-0.5 hover:shadow-md"
3232
>
33+
<!-- Featured Image Container -->
3334
<Link
3435
:href="'/blogs/' + blog.slug"
35-
class="relative block aspect-video overflow-hidden bg-slate-100"
36+
class="relative block aspect-[16/9] overflow-hidden bg-slate-100"
3637
>
3738
<img
3839
:src="blog.featured_image || 'https://placehold.co/600x400'"
3940
:alt="blog.title"
40-
class="h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-105"
41+
class="h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-105"
4142
loading="lazy"
4243
/>
4344
<div
4445
v-if="blog.category"
45-
class="absolute top-3 left-3 rounded-full bg-white/90 px-2.5 py-1 text-[10px] font-extrabold tracking-wider text-slate-900 uppercase shadow-sm backdrop-blur-md"
46+
class="absolute top-2.5 left-2.5 rounded-md bg-indigo-600 px-2 py-0.5 text-[10px] font-bold tracking-wider text-white uppercase shadow-xs"
4647
>
4748
{{ blog.category }}
4849
</div>
4950
</Link>
5051

51-
<div class="flex flex-1 flex-col p-6">
52-
<div class="mb-3 flex items-center gap-2 text-sm text-slate-500">
53-
<span>Author : </span>
54-
52+
<!-- Card Body -->
53+
<div class="flex flex-1 flex-col p-4">
54+
<!-- News Meta (Author & Date) -->
55+
<div
56+
class="mb-1.5 flex items-center gap-1.5 text-xs text-slate-500"
57+
>
58+
<span class="text-slate-400">Author</span>
5559
<Link
5660
:href="`/about-us#${blog.user?.id}`"
57-
class="font-medium text-indigo-600 transition-colors hover:text-indigo-800 hover:underline"
61+
class="font-medium text-indigo-600 underline transition-colors hover:underline"
5862
>
5963
{{ blog.user?.name }}
6064
</Link>
6165

62-
<span
63-
v-if="formattedDate"
64-
class="h-1 w-1 rounded-full bg-slate-300"
65-
></span>
66+
<span v-if="formattedDate" class="text-slate-300">•</span>
6667

6768
<time
6869
v-if="formattedDate"
@@ -73,28 +74,31 @@ return '';
7374
</time>
7475
</div>
7576

77+
<!-- Title -->
7678
<Link :href="'/blogs/' + blog.slug" class="group/title block">
7779
<h3
78-
class="line-clamp-2 text-xl leading-snug font-bold text-slate-900 transition duration-150 group-hover/title:text-indigo-600"
80+
class="line-clamp-2 text-base leading-snug font-bold text-slate-900 transition duration-150 group-hover/title:text-indigo-600"
7981
>
8082
{{ blog.title }}
8183
</h3>
8284
</Link>
8385

86+
<!-- Excerpt -->
8487
<p
85-
class="mt-3 mb-6 line-clamp-3 text-sm leading-relaxed text-slate-500"
88+
class="mt-1.5 mb-3 line-clamp-2 text-xs leading-relaxed text-slate-600"
8689
>
8790
{{ blog.excerpt }}
8891
</p>
8992

90-
<div class="mt-auto border-t border-slate-50 pt-4">
93+
<!-- Footer Action -->
94+
<div class="mt-auto border-t border-slate-100 pt-3">
9195
<Link
9296
:href="'/blogs/' + blog.slug"
93-
class="inline-flex items-center gap-1.5 text-sm font-semibold text-indigo-600 transition hover:text-indigo-700"
97+
class="inline-flex items-center gap-1 text-xs font-semibold text-indigo-600 transition hover:text-indigo-700"
9498
>
95-
<span>বিস্তারিত পড়ুন </span>
99+
<span>বিস্তারিত পড়ুন</span>
96100
<ArrowRight
97-
class="h-4 w-4 transform transition-transform duration-200 group-hover:translate-x-1"
101+
class="h-3.5 w-3.5 transform transition-transform duration-200 group-hover:translate-x-1"
98102
/>
99103
</Link>
100104
</div>

‎resources/js/pages/Blog/Show.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const copyLink = async () => {
147147

148148
<Link
149149
:href="`/about-us#author-${blog.user?.id}`"
150-
class="mt-1 block text-lg font-semibold text-slate-900 transition hover:text-indigo-600"
150+
class="mt-1 block text-lg font-semibold underline transition text-slate-900"
151151
>
152152
{{ blog.user?.name }}
153153
</Link>

0 commit comments

Comments
 (0)