diff --git a/frontend/src/Router.jsx b/frontend/src/Router.jsx
index 8868ec1..66b19f3 100644
--- a/frontend/src/Router.jsx
+++ b/frontend/src/Router.jsx
@@ -25,6 +25,7 @@ const MyInfoChangePage = lazy(async () => await import('./pages/MyInfoChangePage
const PasswordChangePage = lazy(async () => await import('./pages/PasswordChangePage'));
const LearningLecturesPage = lazy(async () => await import('./pages/LearningLecturesPage'));
const LectureCreatePage = lazy(async () => await import('./pages/LectureCreatePage'));
+const EditQuestionPage = lazy(async () => await import('./pages/EditQuestionPage'));
const router = createBrowserRouter([
{
@@ -97,7 +98,20 @@ const router = createBrowserRouter([
},
{
path: ':questionId',
- element: ,
+ children: [
+ {
+ index: true,
+ element: ,
+ },
+ {
+ path: 'edit',
+ element: ,
+ },
+ ],
+ },
+ {
+ path: ':questionId/edit',
+ element: ,
},
{
path: 'write',
diff --git a/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx b/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx
index 9315604..3c6c692 100644
--- a/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx
+++ b/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx
@@ -2,29 +2,81 @@ import BackIcon from '/src/assets/icons/back.svg?react';
import { Link } from 'react-router-dom';
import styles from './ArticleDetail.module.css';
import ArticleDetailAnswer from './ArticleDetailAnswer/ArticleDetailAnswer';
+import ArticleDetailAnswerInput from './ArticleDetailAnswer/ArticleDetailAnswerInput';
+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 }) {
- // TODO: 답변 작성 기능 추가
+export default function ArticleDetail({ topic, title, author = null, content, answer = null, onDelete }) {
+ const [submittedAnswer, setSubmittedAnswer] = useState(answer);
+ const [isEditing, setIsEditing] = useState(false);
+
+ useEffect(() => {
+ setSubmittedAnswer(answer);
+ }, [answer]);
+
+ const handleAnswerSubmit = (newAnswer) => {
+ setSubmittedAnswer(newAnswer);
+ setIsEditing(false);
+ };
+
+ const handleEditClick = () => {
+ setIsEditing(true);
+ };
+
+ const handleDeleteSubmit = () => {
+ setSubmittedAnswer(null);
+ setIsEditing(false);
+ };
return (