Skip to content

Commit 0f01fde

Browse files
committed
refactor: PostCard 컴포넌트 분리
1 parent c03f8fa commit 0f01fde

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/components/PostCard/PostCard.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,9 @@
2929

3030
<script setup lang="ts">
3131
import { getCategoryColor } from "@/constants/colors";
32+
import type { Post } from "@/models/PostModel";
3233
import "./PostCard.css";
3334
34-
interface Post {
35-
url: string;
36-
frontmatter: {
37-
title: string;
38-
createdAt: string;
39-
category: string;
40-
description: string;
41-
};
42-
}
43-
4435
interface Props {
4536
post: Post;
4637
}

src/components/PostCardList/PostCardList.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
</template>
88

99
<script setup lang="ts">
10-
import { posts } from "../../../.vitepress/data/posts";
10+
import postsData from "../../../data/posts.json";
1111
import { computed } from "vue";
1212
import PostCard from "../PostCard/PostCard.vue";
13+
import type { Post } from "@/models/PostModel";
1314
import "./PostCardList.css";
1415
1516
interface Props {
@@ -20,6 +21,8 @@ const props = withDefaults(defineProps<Props>(), {
2021
category: undefined,
2122
});
2223
24+
const posts = postsData as Post[];
25+
2326
const sortedPosts = computed(() => {
2427
if (props.category) {
2528
return posts.filter(

0 commit comments

Comments
 (0)