feat: 공지사항은 댓글 안 받게 추가

This commit is contained in:
minwucho 2024-08-06 10:10:12 +09:00
parent fc1f16e725
commit 0647558b32
2 changed files with 15 additions and 13 deletions

View File

@ -6,7 +6,7 @@ import ArticleDetailAnswerInput from './ArticleDetailAnswer/ArticleDetailAnswerI
import EditIcon from '/src/assets/icons/edit.svg?react';
import { useState, useEffect } from 'react';
export default function ArticleDetail({ topic, title, author = null, content, answer = null, onDelete }) {
export default function ArticleDetail({ topic, title, author = null, content, answer = null, onDelete, isQna = true }) {
const [submittedAnswer, setSubmittedAnswer] = useState(answer);
const [isEditing, setIsEditing] = useState(false);
@ -65,18 +65,19 @@ export default function ArticleDetail({ topic, title, author = null, content, an
<p className={styles.content}>{content}</p>
</div>
{/* TODO: 이 부분에서 answer 만든다음 뒤로가기로 나갔다가 돌아오면 0.1초 정도 input 칸이 보였다가 answer 로 바뀜. 수정필요 */}
{submittedAnswer && !isEditing ? (
<ArticleDetailAnswer
answer={submittedAnswer}
onEditClick={handleEditClick}
onDeleteSubmit={handleDeleteSubmit}
/>
) : (
<ArticleDetailAnswerInput
onSubmit={handleAnswerSubmit}
initialAnswer={submittedAnswer}
/>
)}
{isQna &&
(submittedAnswer && !isEditing ? (
<ArticleDetailAnswer
answer={submittedAnswer}
onEditClick={handleEditClick}
onDeleteSubmit={handleDeleteSubmit}
/>
) : (
<ArticleDetailAnswerInput
onSubmit={handleAnswerSubmit}
initialAnswer={submittedAnswer}
/>
))}
</div>
);
}

View File

@ -23,6 +23,7 @@ export default function NoticeDetailPage() {
title={notice.title}
content={notice.content}
onDelete={handleDelete}
isQna={false}
/>
);
}