Skip to content

Commit 0aaf69a

Browse files
committed
Add Tag component and update blog index to display tags using the new component
1 parent 8bfbf61 commit 0aaf69a

File tree

4 files changed

+23
-44
lines changed

4 files changed

+23
-44
lines changed

.vscode/settings.json

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,7 @@
198198
"zophie"
199199
],
200200
"workbench.colorCustomizations": {
201-
"activityBar.activeBorder": "#945bc4",
202-
"activityBar.activeBackground": "#2f344a",
203-
"activityBar.background": "#2f344a",
204-
"activityBar.foreground": "#e7e7e7",
205-
"activityBar.inactiveForeground": "#e7e7e799",
206-
"activityBarBadge.background": "#885760",
207-
"activityBarBadge.foreground": "#e7e7e7",
208-
"commandCenter.border": "#e7e7e799",
209-
"sash.hoverBorder": "#2f344a",
210-
"statusBar.background": "#1b1e2b",
211-
"statusBar.foreground": "#e7e7e7",
212-
"statusBarItem.hoverBackground": "#2f344a",
213-
"statusBarItem.remoteBackground": "#1b1e2b",
214-
"statusBarItem.remoteForeground": "#e7e7e7",
215-
"titleBar.activeBackground": "#1b1e2b",
216-
"titleBar.activeForeground": "#e7e7e7",
217-
"titleBar.inactiveBackground": "#1b1e2b99",
218-
"titleBar.inactiveForeground": "#e7e7e799"
201+
"activityBar.activeBorder": "#945bc4"
219202
},
220203
"peacock.remoteColor": "1b1e2b",
221204
"cSpell.language": "en",

src/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ declare module 'vue' {
5353
RouterView: typeof import('vue-router')['RouterView']
5454
SubscriptionForm: typeof import('./components/SubscriptionForm.vue')['default']
5555
Switch: typeof import('@headlessui/vue')['Switch']
56+
Tag: typeof import('./components/ui/Tag.vue')['default']
5657
TheFooter: typeof import('./components/layout/TheFooter.vue')['default']
5758
TheNavbar: typeof import('./components/layout/TheNavbar.vue')['default']
5859
TheNavbarReader: typeof import('./components/layout/TheNavbarReader.vue')['default']

src/components/ui/Tag.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<span
3+
class="rounded text-xs bg-sky-500 px-1.5 py-1 dark:bg-sky-600 text-slate-50 dark:text-white"
4+
>
5+
#<slot />
6+
</span>
7+
</template>
8+
9+
<script setup lang="ts">
10+
// No props needed, tag content is passed via slot
11+
</script>

src/pages/blog/index.vue

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,14 @@ const getTags = (article) => {
6868
/>
6969
</svg>
7070
</div>
71-
<div
72-
class="absolute top-0 left-0 w-full bg-gradient-to-b from-black/70 to-transparent p-4"
73-
>
74-
<div class="flex flex-wrap gap-2">
75-
<span
76-
v-for="tag in getTags(latestArticle).slice(0, 2)"
77-
:key="tag"
78-
class="rounded-full bg-sky-500/80 px-2.5 py-0.5 text-xs text-white"
79-
>
80-
#{{ tag }}
81-
</span>
82-
</div>
83-
</div>
8471
</div>
8572
<div class="flex flex-col p-6 md:w-1/2">
8673
<div class="flex-1">
74+
<div class="mb-2 flex flex-wrap gap-2">
75+
<Tag v-for="tag in getTags(latestArticle).slice(0, 2)" :key="tag">
76+
{{ tag }}
77+
</Tag>
78+
</div>
8779
<h2
8880
class="text-2xl font-semibold text-slate-800 dark:text-slate-100"
8981
>
@@ -152,22 +144,14 @@ const getTags = (article) => {
152144
/>
153145
</svg>
154146
</div>
155-
<div
156-
class="absolute top-0 left-0 w-full bg-gradient-to-b from-black/70 to-transparent p-4"
157-
>
158-
<div class="flex flex-wrap gap-2">
159-
<span
160-
v-for="tag in getTags(article).slice(0, 2)"
161-
:key="tag"
162-
class="rounded-full bg-sky-500/80 px-2.5 py-0.5 text-xs text-white"
163-
>
164-
#{{ tag }}
165-
</span>
166-
</div>
167-
</div>
168147
</div>
169148
<div class="flex flex-1 flex-col p-6">
170149
<div class="flex-1">
150+
<div class="mb-2 flex flex-wrap gap-2">
151+
<Tag v-for="tag in getTags(article).slice(0, 2)" :key="tag">
152+
{{ tag }}
153+
</Tag>
154+
</div>
171155
<h2 class="text-xl font-semibold text-slate-800 dark:text-slate-100">
172156
{{ article.children[0]?.meta?.title }}
173157
</h2>

0 commit comments

Comments
 (0)