Skip to content

Commit 3edad6b

Browse files
committed
feat: PostHeader 추가 및 레이아웃 적용
1 parent 6839bd7 commit 3edad6b

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.post-header {
2+
margin-bottom: 2rem;
3+
padding-bottom: 1.5rem;
4+
border-bottom: 1px solid var(--vp-c-divider);
5+
}
6+
7+
.post-meta {
8+
display: flex;
9+
align-items: center;
10+
justify-content: space-between;
11+
gap: 0.75rem;
12+
margin-bottom: 1rem;
13+
flex-wrap: wrap;
14+
}
15+
16+
.category-tag {
17+
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;
22+
23+
border-radius: 1rem;
24+
text-transform: uppercase;
25+
letter-spacing: 0.05em;
26+
}
27+
28+
.created-date {
29+
color: var(--vp-c-text-2);
30+
font-size: 0.875rem;
31+
font-weight: 500;
32+
}
33+
34+
.post-title {
35+
font-size: 2.25rem;
36+
font-weight: 700;
37+
line-height: 1.2;
38+
margin: 0 0 1rem 0;
39+
color: var(--vp-c-text-1);
40+
}
41+
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;
48+
}
49+
50+
/* 다크 테마 대응 */
51+
.dark .category-tag {
52+
background-color: var(--vp-c-brand-dark);
53+
}
54+
55+
/* 모바일 반응형 */
56+
@media (max-width: 768px) {
57+
.post-title {
58+
font-size: 1.875rem;
59+
}
60+
61+
.post-description {
62+
font-size: 1rem;
63+
}
64+
65+
.post-meta {
66+
gap: 0.5rem;
67+
}
68+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script setup lang="ts">
2+
import { useData } from "vitepress";
3+
import { computed } from "vue";
4+
import { formatDate } from "@/utils/date";
5+
6+
const { frontmatter } = useData();
7+
8+
const title = computed(() => frontmatter.value.title || "");
9+
const createdAt = computed(() => frontmatter.value.createdAt || "");
10+
const category = computed(() => frontmatter.value.category || "");
11+
const description = computed(() => frontmatter.value.description || "");
12+
</script>
13+
14+
<template>
15+
<header class="post-header">
16+
<h1 class="post-title">{{ title }}</h1>
17+
18+
<div class="post-meta">
19+
<span v-if="category" class="category-tag">{{ category }}</span>
20+
<time v-if="createdAt" class="created-date">{{ formatDate(createdAt) }}</time>
21+
</div>
22+
</header>
23+
</template>
24+
25+
<style>
26+
@import "./PostHeader.css";
27+
</style>

src/components/PostLayout/PostLayout.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22
import { useData } from "vitepress";
33
import DefaultTheme from "vitepress/theme";
44
import PostComment from "@/components/PostComment/PostComment.vue";
5+
import PostHeader from "@/components/PostHeader/PostHeader.vue";
56
const { Layout } = DefaultTheme;
67
78
const { frontmatter } = useData();
89
10+
const showHeader = Boolean(frontmatter.value.title);
911
const showComments = frontmatter.value.comment === true;
1012
</script>
1113

1214
<template>
1315
<Layout>
16+
<template #doc-before>
17+
<PostHeader v-if="showHeader" />
18+
</template>
19+
1420
<template #doc-after>
1521
<PostComment v-if="showComments" />
1622
</template>

0 commit comments

Comments
 (0)