1
0
mirror of https://github.com/robonen/lorem-blog.git synced 2026-03-20 19:04:40 +00:00

feat(comment): add Comment entity with types and UI component

This commit is contained in:
2025-06-15 15:39:33 +07:00
parent ff91e96fc6
commit 7eb1528a55
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export * from './types';
export { default as Comment } from './ui/Comment.vue';

View File

@@ -0,0 +1,7 @@
export interface PostComment {
id: number;
avatar: string;
name: string;
text: string;
created_at: string;
}

View File

@@ -0,0 +1,29 @@
<script lang="ts">
export interface CommentProps extends Omit<PostComment, 'text'> {}
</script>
<script setup lang="ts">
import type { PostComment } from '../types';
import { formatDateTime } from '@/shared/utils';
const props = defineProps<CommentProps>();
</script>
<template>
<div class="flex items-center gap-3">
<img
class="w-10 h-10 rounded-full object-cover"
:src="props.avatar"
:alt="props.name"
>
<div class="flex flex-col">
<span class="text-sm font-semibold text-gray-900">
{{ props.name }}</span>
<p class="text-sm">
<slot />
</p>
<span class="text-xs text-foreground-muted-light">
{{ formatDateTime(props.created_at) }}</span>
</div>
</div>
</template>