diff --git a/frontend/src/components/Article/CreateArticle/CreateArticle.jsx b/frontend/src/components/Article/CreateArticle/CreateArticle.jsx index db4a5b0..10100bb 100644 --- a/frontend/src/components/Article/CreateArticle/CreateArticle.jsx +++ b/frontend/src/components/Article/CreateArticle/CreateArticle.jsx @@ -1,43 +1,69 @@ -import { Link } from 'react-router-dom'; +import { useState } from 'react'; +import { Link, useNavigate } from 'react-router-dom'; import styles from './CreateArticle.module.css'; -export default function CreateArticle() { +export default function CreateArticle({ topic, title, backPath = '/' }) { + const navigate = useNavigate(); + + const [articleTitle, setArticleTitle] = useState(''); + const [content, setContent] = useState(''); + + const handleSubmit = (e) => { + e.preventDefault(); + // TODO: 글 작성 기능 연결 + if (articleTitle && content) { + navigate(backPath); + } + }; // TODO: 입력 크기에 따라 반응형으로 textarea 크기 변경 + return (
-
+
-
-
Q&A
+
{title}
-
질문하기
+
{topic}
-
-
-
- - -
-
- - -
-
- -
-
-
+
+
+ + setArticleTitle(e.target.value)} + /> +
+
+ + +
+ +
); }