프로필, 댓글 디자인 정리

This commit is contained in:
kimdaae328 2025-01-24 12:26:46 +09:00
parent 93d7acd745
commit 8b38019b95
5 changed files with 177 additions and 68 deletions

View File

@ -1,56 +1,74 @@
<template> <template>
<ul class="list-unstyled"> <div>
<li> <BoardProfile :profileName="comment.author" :showDetail="false" :author="true" />
<BoardProfile profileName=곤데리 :showDetail="false" :author="true" /> <div class="my-6">
<div class="mt-2">저도 궁금합니다.</div> <p>{{ comment.content }}</p>
<PlusButton @click="toggleComment"/> </div>
<BoardComentArea v-if="comment" /> <PlusButton v-if="isPlusButton" @click="toggleComment"/>
<ul class="list-unstyled twoDepth"> <BoardComentArea v-if="isComment" @submit="submitComment"/>
<li>
<BoardProfile profileName=곤데리2 :showDetail="false" /> <!-- 대댓글 -->
<div class="mt-2">저도 궁금합니다.</div> <ul v-if="comment.children && comment.children.length" class="list-unstyled">
<BoardComentArea v-if="comment" /> <li
</li> v-for="child in comment.children"
</ul> :key="child.id"
</li> class="pt-6 ps-10 border-top"
<li> style="border-color:blue !important;"
<BoardProfile profileName=곤데리 :showDetail="false" /> >
<div class="mt-2">저도 궁금합니다.</div> <BoardComment :comment="child" :isPlusButton="false" @submitComment="addChildComment" />
<PlusButton @click="toggleComment"/> </li>
<BoardComentArea v-if="comment" /> </ul>
</li> <!-- <ul class="list-unstyled twoDepth">
<li> <li>
<BoardProfile profileName=곤데리 :showDetail="false" /> <BoardProfile profileName=곤데리2 :showDetail="false" />
<div class="mt-2">저도 궁금합니다.</div> <div class="mt-2">저도 궁금합니다.</div>
<PlusButton @click="toggleComment"/> <BoardComentArea v-if="comment" />
<BoardComentArea v-if="comment" /> </li>
</li> </ul> -->
</ul> <!-- <BoardProfile profileName=곤데리 :showDetail="false" />
<Pagination/> <div class="mt-2">저도 궁금합니다.</div>
<PlusButton @click="toggleComment"/>
<BoardComentArea v-if="comment" /> -->
</div>
</template> </template>
<script setup> <script setup>
import BoardProfile from './BoardProfile.vue'; import BoardProfile from './BoardProfile.vue';
import BoardComentArea from './BoardComentArea.vue'; import BoardComentArea from './BoardComentArea.vue';
import { ref, computed } from 'vue';
import Pagination from '../pagination/Pagination.vue';
import PlusButton from '../button/PlusBtn.vue'; import PlusButton from '../button/PlusBtn.vue';
import { ref } from 'vue';
import { defineEmits } from 'vue'; import { defineEmits } from 'vue';
const comment = ref(false); const props = defineProps({
comment: {
const toggleComment = () => { type: Object,
comment.value = !comment.value required: true,
}; },
isPlusButton: {
type: Boolean,
default: true,
}
});
// emits // emits
const emit = defineEmits(['submitComment']); const emit = defineEmits(['submitComment']);
//
const isComment = ref(false);
const toggleComment = () => {
isComment.value = !isComment.value;
};
//
const addChildComment = (parentId, newComment) => {
emit('submitComment', parentId, newComment);
};
</script> </script>
<style scoped> <style scoped>
.twoDepth { /* .twoDepth {
margin-top: 10px; margin-top: 10px;
padding-left: 40px; padding-left: 40px;
} }
@ -66,5 +84,5 @@ const emit = defineEmits(['submitComment']);
.btn-text-primary:active, .btn-text-primary:active,
.btn-text-primary:focus { .btn-text-primary:focus {
background-color: transparent background-color: transparent
} } */
</style> </style>

View File

@ -0,0 +1,52 @@
<template>
<ul class="list-unstyled mt-10">
<li
v-for="comment in comments"
:key="comment.id"
class="mt-6 border-bottom"
style="border-color:red !important;"
>
<BoardComment :comment="comment" @submitComment="addComment" />
</li>
</ul>
<Pagination/>
</template>
<script setup>
import { ref } from 'vue';
import Pagination from '../pagination/Pagination.vue';
import BoardComment from './BoardComment.vue'
const comments = ref([
{
id: 1,
author: '홍길동',
content: '저도 궁금합니다.',
children: [
{
id: 2,
author: '사용자1',
content: '저도요!',
},
{
id: 3,
author: '사용자2',
content: '저도..',
},
],
},
{
id: 4,
author: '사용자4',
content: '흥미로운 주제네요.',
children: [],
},
{
id: 5,
author: '사용자5',
content: '우오아아아아아앙',
children: [],
},
]);
</script>

View File

@ -1,30 +1,45 @@
<template> <template>
<div class="d-flex flex-column flex-sm-row align-items-center"> <div class="d-flex align-items-center flex-wrap">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<!-- 프로필 이미지 부분 -->
<div class="avatar me-2" v-if="unknown"> <div class="avatar me-2" v-if="unknown">
<img src="/img/avatars/2.png" alt="Avatar" class="rounded-circle" /> <img src="/img/avatars/2.png" alt="Avatar" class="rounded-circle" />
</div> </div>
<div class="me-2"> <div class="me-2">
<h6 class="mb-0">{{ profileName }}</h6> <h6 class="mb-0">{{ profileName }}</h6>
<div> <div class="profile-detail">
<span class="me-3">2024.12.10 10:46</span> <span>2024.12.10 10:46</span>
<template v-if="showDetail"> <template v-if="showDetail">
<span class="me-2"> <span>
<i class="fa-regular fa-eye"></i> {{ views }} <i class="fa-regular fa-eye"></i> 1
</span> </span>
<span class="me-2"> <span>
<i class="bx bx-comment"></i> {{ comments }} <i class="fa-regular fa-thumbs-up"></i> 1
</span>
<span>
<i class="fa-regular fa-thumbs-down"></i> 1
</span> </span>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
<div class="ms-auto w-100 mt-2 mt-sm-0"> <div class="ms-auto btn-area">
<template v-if="showDetail"> <template v-if="showDetail">
<EditButton @click="handleEdit" class="me-2" style="border:1px solid blue"/> <EditButton @click="handleEdit" />
<DeleteButton @click="handleDelete" /> <DeleteButton @click="handleDelete" />
</template> </template>
<template v-else>
<template v-if="author">
<EditButton />
<DeleteButton />
<!-- <button class="btn author btn-label-primary btn-icon" @click="handleEdit">
<i class='bx bx-edit-alt'></i>
</button>
<button class="btn author btn-label-primary btn-icon" @click="handleDelete">
<i class='bx bx-trash'></i>
</button> -->
</template>
<BoardRecommendBtn :likeClicked="true" :dislikeClicked="false" :isRecommend="false" />
</template>
</div> </div>
</div> </div>
</template> </template>
@ -41,7 +56,7 @@ import { onMounted } from 'vue';
const router = useRouter(); const router = useRouter();
// Props // Props
const props = defineProps({ defineProps({
profileName: { profileName: {
type: String, type: String,
default: '익명', default: '익명',
@ -54,17 +69,9 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
// author: { author: {
// type: Boolean, type: Boolean,
// default: true, default: false,
// },
views: {
type: Number,
default: 0,
},
comments: {
type: Number,
default: 0,
}, },
}); });
@ -91,10 +98,26 @@ const handleDelete = async () => {
</script> </script>
<style scoped> <style scoped>
/* @media screen and (max-width: 450px) { .profile-detail span ~ span {
margin-left: 5px;
}
.ms-auto button + button {
margin-left: 5px;
}
.btn.author {
height: 30px;
}
@media screen and (max-width: 450px) {
.btn-area { .btn-area {
margin-top: 10px; margin-top: 10px;
width: 100%; width: 100%;
} }
} */
.btn.author {
height: 30px;
}
}
</style> </style>

View File

@ -1,4 +1,4 @@
<template> <template v-if="isRecommend">
<button class="btn btn-label-primary btn-icon" :class="likeClicked ? 'clicked' : '', bigBtn ? 'big' : '' "> <button class="btn btn-label-primary btn-icon" :class="likeClicked ? 'clicked' : '', bigBtn ? 'big' : '' ">
<i class="fa-regular fa-thumbs-up"></i> <span class="num">1</span> <i class="fa-regular fa-thumbs-up"></i> <span class="num">1</span>
</button> </button>
@ -20,6 +20,10 @@ defineProps({
bigBtn : { bigBtn : {
type :Boolean, type :Boolean,
default : false, default : false,
},
isRecommend: {
type:Boolean,
default:true,
} }
}); });
</script> </script>

View File

@ -6,6 +6,7 @@
<!-- 프로필 헤더 --> <!-- 프로필 헤더 -->
<div class="card-header"> <div class="card-header">
<BoardProfile :boardId="currentBoardId" :profileName="profileName" /> <BoardProfile :boardId="currentBoardId" :profileName="profileName" />
<hr/>
</div> </div>
<!-- 게시글 내용 --> <!-- 게시글 내용 -->
<div class="card-body"> <div class="card-body">
@ -14,20 +15,29 @@
<div class="board-content text-body" style="line-height: 1.6;" v-html="$common.contentToHtml(boardContent)"> <div class="board-content text-body" style="line-height: 1.6;" v-html="$common.contentToHtml(boardContent)">
</div> </div>
<!-- 좋아요 버튼 -->
<div class="row justify-content-center my-10">
<BoardRecommendBtn :bigBtn="true"/>
</div>
<!-- 첨부파일 목록 --> <!-- 첨부파일 목록 -->
<ul v-if="attachments.length" class="attachments mt-4 list-unstyled"> <ul v-if="attachments.length" class="attachments mt-4 list-unstyled">
<li v-for="(attachment, index) in attachments" :key="index" class="mb-2"> <li v-for="(attachment, index) in attachments" :key="index" class="mb-2">
<a :href="attachment.url" target="_blank" class="text-decoration-none">{{ attachment.name }}</a> <a :href="attachment.url" target="_blank" class="text-decoration-none">{{ attachment.name }}</a>
</li> </li>
</ul> </ul>
<!-- 댓글 영역 --> <!-- 댓글 영역 -->
<BoardComentArea :comments="comments" /> <BoardComentArea :comments="comments" />
</div>
<!-- 수정 버튼 --> <!-- 수정 버튼 -->
<div class="card-footer d-flex justify-content-end"> <!-- <button class="btn btn-primary" @click="goToEditPage">
<button class="btn btn-primary" @click="goToEditPage">
수정 수정
</button> </button> -->
</div>
<div class="card-footer">
<BoardCommentList/>
</div> </div>
</div> </div>
</div> </div>
@ -37,7 +47,9 @@
<script setup> <script setup>
import BoardComentArea from '@c/board/BoardComentArea.vue'; import BoardComentArea from '@c/board/BoardComentArea.vue';
import BoardCommentList from '@/components/board/BoardCommentList.vue';
import BoardProfile from '@c/board/BoardProfile.vue'; import BoardProfile from '@c/board/BoardProfile.vue';
import BoardRecommendBtn from '@/components/button/BoardRecommendBtn.vue';
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import axios from '@api'; import axios from '@api';