diff --git a/src/app/components/common/post-box.js b/src/app/components/common/post-box.js new file mode 100644 index 0000000..f32010d --- /dev/null +++ b/src/app/components/common/post-box.js @@ -0,0 +1,127 @@ +'use client'; + +import { useState } from 'react'; +import ConfirmModal from './post-confirm'; +import WritingPage from './post-page'; + +export default function PostBox({ onClose }) { + const [showConfirm, setShowConfirm] = useState(false); + const [showFullPage, setShowFullPage] = useState(false); + + const handleSubmit = () => { + console.log('등록 처리 완료'); + setShowConfirm(false); + onClose(); + }; + + const handleExpand = () => { + setShowFullPage(true); + }; + + if (showFullPage) { + return ; + } + + return ( +
+
+

상품 등록

+
+ {/* 이미지 업로드 */} +
+ + +
+ + {/* 제목 */} +
+ + +
+ + {/* 금액 + 인원 */} +
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ + {/* 카테고리 + 거래방식 */} +
+
+ + +
+
+ + +
+
+ + {/* 상세설명 */} +
+ + +
+ + {/* 등록 버튼 */} + +
+ + {/* 등록 확인 모달 */} + {showConfirm && ( + setShowConfirm(false)} + onConfirm={handleSubmit} + /> + )} + + + + +
+
+ ); +} diff --git a/src/app/components/common/post-confirm.js b/src/app/components/common/post-confirm.js new file mode 100644 index 0000000..2011e2b --- /dev/null +++ b/src/app/components/common/post-confirm.js @@ -0,0 +1,13 @@ +export default function ConfirmModal({ onConfirm, onCancel }) { + return ( +
+
+

상품을 등록하시겠습니까?

+
+ + +
+
+
+ ); +} diff --git a/src/app/components/common/post-page.js b/src/app/components/common/post-page.js new file mode 100644 index 0000000..1afe1b7 --- /dev/null +++ b/src/app/components/common/post-page.js @@ -0,0 +1,124 @@ +'use client'; + +import { useState } from 'react'; +import { useRef } from 'react'; +import ConfirmModal from './post-confirm'; + +export default function WritingPage() { + const [showConfirm, setShowConfirm] = useState(false); + + const handleSubmit = () => { + console.log('등록 처리 완료'); + setShowConfirm(false); + onClose(); + }; + + const fileInputRef = useRef(null); + + const handleClick = () => { + fileInputRef.current?.click(); + }; + + return ( +
+ {/*

상품 등록

*/} +
+ {/* 이미지 업로드 */} +
+ +
📷 + 이미지 등록
+ +
+ + {/* 제목 */} +
+ + +
+ + {/* 금액 + 인원 */} +
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ + {/* 카테고리 + 거래방식 */} +
+
+ + +
+
+ + +
+
+ + {/* 상세설명 */} +
+ + +
+ + {/* 등록 버튼 */} + +
+ + {/* 등록 확인 모달 */} + {showConfirm && ( + setShowConfirm(false)} + onConfirm={handleSubmit} + /> + )} +
+ ); +} diff --git a/src/app/components/common/post-unuse.js b/src/app/components/common/post-unuse.js new file mode 100644 index 0000000..4c1d092 --- /dev/null +++ b/src/app/components/common/post-unuse.js @@ -0,0 +1,71 @@ +// import { useState } from "react"; +// import Image from "next/image"; +// import category_lists from "@constants/simpleDB"; +// +// export default function PostBox({ onClose }) { +// const [activeTags, setActiveTags] = useState([]); +// +// const handleClick = (value) => { +// setActiveTags((prev) => +// prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value] +// ); +// }; +// +// return ( +//
+// {/* 상단 */} +//
+// +//

게시글

+//
+// +// {/* 제목 */} +//
+// +// +//
+// +// {/* 이미지 첨부 */} +//
+// +//
+//
+//
+// +//
+//
+// +// {/* 본문 입력 */} +//
+//