Skip to content

Commit 4a76c92

Browse files
committed
feat: PostHeader의 카테고리 표시 방식 개선 및 스타일 수정
1 parent 3edad6b commit 4a76c92

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

src/components/PostHeader/PostHeader.css

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,55 @@
88
display: flex;
99
align-items: center;
1010
justify-content: space-between;
11+
flex-wrap: wrap;
1112
gap: 0.75rem;
13+
1214
margin-bottom: 1rem;
13-
flex-wrap: wrap;
1415
}
1516

16-
.category-tag {
17+
.post-category {
18+
display: flex;
19+
align-items: center;
20+
gap: 0.125rem;
21+
}
22+
23+
.post-category * {
24+
display: block;
25+
}
26+
27+
.post-category .category-tag {
1728
display: inline-block;
18-
background-color: var(--vp-c-brand);
19-
color: var(--vp-c-white);
20-
font-size: 0.75rem;
21-
font-weight: 600;
2229

23-
border-radius: 1rem;
24-
text-transform: uppercase;
30+
font-size: 0.875rem;
2531
letter-spacing: 0.05em;
32+
33+
color: var(--vp-c-text-2);
34+
background-color: var(--vp-c-brand);
35+
}
36+
37+
.post-category .category-indicator {
38+
display: inline-block;
39+
40+
width: 12px;
41+
height: 12px;
42+
43+
margin-right: 0.5rem;
44+
border-radius: 50%;
2645
}
2746

2847
.created-date {
2948
color: var(--vp-c-text-2);
3049
font-size: 0.875rem;
31-
font-weight: 500;
3250
}
3351

3452
.post-title {
53+
margin: 0 0 1.5rem 0;
54+
3555
font-size: 2.25rem;
3656
font-weight: 700;
3757
line-height: 1.2;
38-
margin: 0 0 1rem 0;
39-
color: var(--vp-c-text-1);
40-
}
4158

42-
.post-description {
43-
font-size: 1.125rem;
44-
line-height: 1.6;
45-
color: var(--vp-c-text-2);
46-
margin: 0;
47-
font-weight: 400;
59+
color: var(--vp-c-text-1);
4860
}
4961

5062
/* 다크 테마 대응 */

src/components/PostHeader/PostHeader.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22
import { useData } from "vitepress";
33
import { computed } from "vue";
44
import { formatDate } from "@/utils/date";
5+
import { getCategoryColor } from "@/constants/colors";
56
67
const { frontmatter } = useData();
78
89
const title = computed(() => frontmatter.value.title || "");
910
const createdAt = computed(() => frontmatter.value.createdAt || "");
1011
const category = computed(() => frontmatter.value.category || "");
11-
const description = computed(() => frontmatter.value.description || "");
1212
</script>
1313

1414
<template>
1515
<header class="post-header">
1616
<h1 class="post-title">{{ title }}</h1>
1717

1818
<div class="post-meta">
19-
<span v-if="category" class="category-tag">{{ category }}</span>
19+
<div class="post-category" v-if="category">
20+
<span
21+
class="category-indicator"
22+
:style="{ backgroundColor: getCategoryColor(category) }"
23+
/>
24+
<span class="category-tag">{{ category }}</span>
25+
</div>
2026
<time v-if="createdAt" class="created-date">{{ formatDate(createdAt) }}</time>
2127
</div>
2228
</header>

0 commit comments

Comments
 (0)