Skip to content

Commit c73e937

Browse files
feat: improve blog list page
1 parent 02baab1 commit c73e937

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed

app/layouts/default.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22
<div class="w-full font-normal font-[Inter_Variable] prose-neutral dark:prose-invert">
33
<div>
44
<navbar />
5-
<div class="m-a lt-md:px-4 lg:prose">
5+
<div class="m-a lt-md:px-4 lg:prose" :class="[$style.dashed_link]">
66
<slot />
77
<div class="h-8" />
88
<cd />
99
</div>
1010
</div>
1111
</div>
1212
</template>
13+
14+
<style lang="scss" module>
15+
.dashed_link {
16+
a {
17+
--at-apply: "underline-dashed hover:underline-solid"
18+
}
19+
}
20+
</style>

app/pages/blogs/[...slugs].vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ const ContentNotFound = defineComponent({
1212
<template>
1313
<content-doc>
1414
<template #default="{ doc }">
15-
<h1>{{ doc.title }}</h1>
16-
<p>{{ useDateFormat(doc.date, 'ddd, DD MMM YYYY') }}</p>
15+
<div class="pb-4">
16+
<h1>{{ doc.title }}</h1>
17+
<p class="op-70">
18+
{{ useDateFormat(doc.date, 'ddd, DD MMM YYYY') }}
19+
</p>
20+
</div>
1721
<content-renderer :value="doc" />
1822
</template>
1923
<template #not-found>

app/pages/blogs/index.vue

+20-11
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@ useHead({ title: 'Blogs' })
44

55
<template>
66
<div>
7-
<h1>Blogs</h1>
7+
<h1 class="pb-4">
8+
Blogs
9+
</h1>
810
<content-list v-slot="{ list }" path="/blogs">
9-
<template v-for="blog in list.sort((a, b) => +new Date(a.date) - +new Date(b.date))" :key="blog._path">
10-
<h3>
11-
<nuxt-link :to="blog._path">
12-
{{ blog.title }}
13-
</nuxt-link>
14-
</h3>
15-
<p>
16-
{{ useDateFormat(blog.date, 'DD MMM YYYY') }}
17-
</p>
18-
</template>
11+
<div class="divide-y divide-gray divide-op-20 dark:(divide-zinc divide-op-25)">
12+
<template
13+
v-for="blog in list.sort((a, b) => +new Date(b.date) - +new Date(a.date))"
14+
:key="blog._path"
15+
>
16+
<div class="flex flex-col items-start py-3 md:(grid-cols-[75%,auto] flex-row pt-2)">
17+
<h3 class="my-2 flex-auto md:m-a">
18+
<nuxt-link :to="blog._path">
19+
{{ blog.title }}
20+
</nuxt-link>
21+
</h3>
22+
<p class="my-0 op-70 md:(m-a flex-shrink-1)">
23+
{{ useDateFormat(blog.date, 'DD MMM YYYY') }}
24+
</p>
25+
</div>
26+
</template>
27+
</div>
1928
</content-list>
2029
</div>
2130
</template>

content/blogs/a-new-home.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: A new home
3-
description: A new home.
43
date: 2023-01-01 00:00:00 UTC
54
---
65

0 commit comments

Comments
 (0)