From 701065f80ec6425cc05adc71e562b214c1c9ec8a Mon Sep 17 00:00:00 2001 From: marie1016 Date: Thu, 4 Jul 2024 23:09:41 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=94=84=EB=A6=B0=ED=8A=B8=20?= =?UTF-8?q?=EB=AF=B8=EC=85=986?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 2 + src/assets/ic_X.svg | 5 + src/assets/ic_plus.svg | 4 + src/components/AddItems.css | 253 ++++++++++++++++++++++++++++++++++++ src/components/AddItems.js | 104 +++++++++++++++ src/components/AllItems.css | 2 +- src/components/AllItems.js | 2 +- src/components/FileInput.js | 71 ++++++++++ src/components/tag.js | 54 ++++++++ 9 files changed, 495 insertions(+), 2 deletions(-) create mode 100644 src/assets/ic_X.svg create mode 100644 src/assets/ic_plus.svg create mode 100644 src/components/AddItems.css create mode 100644 src/components/AddItems.js create mode 100644 src/components/FileInput.js create mode 100644 src/components/tag.js diff --git a/src/App.js b/src/App.js index ddd202414..0b9c48dba 100644 --- a/src/App.js +++ b/src/App.js @@ -2,6 +2,7 @@ import { BrowserRouter, Routes, Route } from "react-router-dom"; import MarketPage from "./pages/Market.js"; import Home from "./pages/Home"; import Navbar from "./components/Navbar"; +import ItemForm from "./components/AddItems.js"; function App() { return ( @@ -11,6 +12,7 @@ function App() { } /> } /> + } /> diff --git a/src/assets/ic_X.svg b/src/assets/ic_X.svg new file mode 100644 index 000000000..10c4a16ed --- /dev/null +++ b/src/assets/ic_X.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/ic_plus.svg b/src/assets/ic_plus.svg new file mode 100644 index 000000000..5bb9abf55 --- /dev/null +++ b/src/assets/ic_plus.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/components/AddItems.css b/src/components/AddItems.css new file mode 100644 index 000000000..c17200c29 --- /dev/null +++ b/src/components/AddItems.css @@ -0,0 +1,253 @@ +.registration-wrapper { + width: 1200px; + margin: 94px auto 0; + display: flex; + align-items: center; + justify-content: space-between; +} + +.registration-title { + font-size: 28px; + font-weight: 700; + line-height: 33.41px; + text-align: left; + color: #1f2937; +} + +.registration-button { + width: 88px; + height: 42px; + padding: 12px 20px; + border: none; + border-radius: 8px; + background-color: #9ca3af; + color: #ffffff; + font-size: 16px; + font-weight: 600; + line-height: 20px; + display: flex; + align-items: center; + justify-content: center; +} + +.img-form { + display: flex; + flex-direction: column; + width: 1200px; + margin: 16px auto 0; +} + +.item-form { + display: flex; + flex-direction: column; + width: 1200px; + margin: 0 auto 87px; +} + +.input-label, +.input-img { + font-size: 18px; + font-weight: 700; + line-height: 21.48px; + text-align: left; + color: #1f2937; +} + +.input-file { + width: 282px; + height: 282px; + border-radius: 12px; + border: none; + background-color: #f3f4f6; + position: relative; +} + +.input-icon { + position: relative; + top: 99px; + left: 117px; +} + +.input-icon-title { + position: absolute; + top: 159px; + left: 104px; + font-size: 16px; + font-weight: 400; + line-height: 24px; + color: #9ca3af; + margin: 0; +} + +.input-file-wrapper { + display: flex; + align-items: center; + gap: 24px; +} + +.input-preview { + width: 282px; + height: 282px; + border: none; + border-radius: 12px; +} + +.input-button { + background: none; + border: none; +} + +.input-button img { + width: 24px; + height: 24px; + position: absolute; + left: 556px; + top: 8px; +} + +.input-label { + margin-bottom: 12px; + margin-top: 24px; +} + +.input-img { + margin-bottom: 12px; +} + +input, +textarea { + height: 56px; + border: none; + border-radius: 12px; + background-color: #f3f4f6; + color: #9ca3af; + font-size: 16px; + font-weight: 400; + line-height: 24px; + text-align: left; + padding: 16px 24px; +} + +textarea { + height: 200px; +} + +.registration-button.active { + background-color: #3692ff; +} + +@media (max-width: 1279px) { + .registration-wrapper { + width: 696px; + margin: 86px auto 0; + } + + .img-form { + width: 696px; + } + + .item-form { + width: 696px; + margin: 0 auto 139px; + } + + .input-file { + width: 162px; + height: 162px; + position: relative; + } + + .input-icon { + position: relative; + top: 39px; + left: 56.5px; + } + + .input-icon-title { + position: absolute; + top: 99px; + left: 43.5px; + } + + .input-file-wrapper { + gap: 16px; + } + + .input-preview { + width: 162px; + height: 162px; + } + + .input-button img { + position: absolute; + left: 308px; + top: 10px; + } + + .input-label { + margin-bottom: 12px; + margin-top: 24px; + } + + .input-img { + margin-bottom: 12px; + } +} + +@media (max-width: 767px) { + .registration-wrapper { + width: 344px; + margin: 86px auto 0; + } + + .img-form { + width: 344px; + } + + .item-form { + width: 344px; + margin: 0 auto 183px; + } + + .input-file { + width: 168px; + height: 168px; + position: relative; + } + + .input-icon { + position: relative; + top: 42px; + left: 60px; + } + + .input-icon-title { + position: absolute; + top: 99px; + left: 43.5px; + } + + .input-file-wrapper { + gap: 8px; + } + + .input-preview { + width: 168px; + height: 168px; + } + + .input-button img { + position: absolute; + left: 310px; + top: 12px; + } + + .input-label { + margin-bottom: 12px; + margin-top: 16px; + } + + .input-img { + margin-bottom: 9px; + } +} diff --git a/src/components/AddItems.js b/src/components/AddItems.js new file mode 100644 index 000000000..6dc84c19b --- /dev/null +++ b/src/components/AddItems.js @@ -0,0 +1,104 @@ +import { useState } from "react"; +import FileInput from "./FileInput"; +import "./AddItems.css"; +import "./global.css"; + +function ItemForm() { + const [values, setValues] = useState({ + imgFile: null, + title: "", + description: "", + price: "", + tag: "", + }); + + const [submit, setSubmit] = useState(false); + + const handleChange = (name, value) => { + setValues((preValues) => ({ + ...preValues, + [name]: value, + })); + }; + + const handleInputChange = (e) => { + const { name, value } = e.target; + handleChange(name, value); + }; + + const handleSubmit = (e) => { + e.preventDefault(); + console.log(values); + setSubmit(true); + }; + + return ( + <> +
+
상품 등록하기
+ +
+
+ + +
+
+ + + +