-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: header * feat : market page best item list * feat: market page all item list * feat:product img input * feat: product name,description,price,tag input * feat:additem page responsive
- Loading branch information
Showing
21 changed files
with
666 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { BrowserRouter, Route, Routes } from "react-router-dom"; | ||
import Market from './pages/Market/Market'; | ||
import AddItem from './pages/AddItem/AddItem'; | ||
|
||
function Router() { | ||
return ( | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/item" element={<Market />}/> | ||
<Route path="/items" element={<Market />}/> | ||
<Route path="/addItem" element={<AddItem />} /> | ||
</Routes> | ||
</BrowserRouter> | ||
) | ||
} | ||
|
||
export default Router | ||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.addItem { | ||
width:100%; | ||
display:flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin-top:29px; | ||
} | ||
.content-container { | ||
max-width:1200px; | ||
width:100%; | ||
height:100%; | ||
display: flex; | ||
flex-direction: column; | ||
gap:32px; | ||
} | ||
.title { | ||
width:109px; | ||
color: var(--Secondary-800, #1F2937); | ||
font-size: 20px; | ||
font-weight: 700; | ||
line-height: 32px; | ||
} | ||
.title-container { | ||
height:42px; | ||
display:flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width:100%; | ||
|
||
} | ||
form { | ||
display:flex; | ||
flex-direction: column; | ||
gap:32px; | ||
} | ||
.submit-button { | ||
width:74px; | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 8px; | ||
border:none; | ||
background:#3692FF; | ||
color: var(--Cool-Gray-100, #F3F4F6); | ||
font-size: 16px; | ||
font-weight: 600; | ||
line-height: 26px; | ||
cursor:pointer; | ||
} | ||
.submit-button:disabled{ | ||
background: var(--Cool-Gray-400, #9CA3AF); | ||
} | ||
|
||
/* tablet */ | ||
@media (max-width:1199px) { | ||
.content-container { | ||
max-width:744px; | ||
} | ||
} | ||
|
||
/* mobile */ | ||
@media (max-width:767px) { | ||
.content-container { | ||
max-width: 375px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import Header from '../../components/Header/Header'; | ||
import './AddItem.css'; | ||
import ProductImg from './components/ProductImg/ProductImg'; | ||
import ProductName from './components/ProductName/ProductName'; | ||
import ProductDescription from './components/ProductDescription/ProductDescription'; | ||
import ProductPrice from './components/ProductPrice/ProductPrice'; | ||
import ProductTag from './components/ProductTag/ProductTag'; | ||
|
||
function AddItem() { | ||
const [isValid, setIsValid] = useState(false); | ||
const [values, setValues] = useState({ | ||
imgFile:null, | ||
name:'', | ||
description:'', | ||
price:'', | ||
tags:[], | ||
}) | ||
|
||
const isFormValid = (values) => { | ||
return (values.name.trim() !== '' && | ||
values.description.trim() !== '' && | ||
values.price > 0 && | ||
values.tags.length > 0); | ||
} | ||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
if(!isFormValid(values)){ | ||
return; | ||
} | ||
console.log(values); | ||
} | ||
const handleChange = (name, value) => { | ||
setValues((prevValues) => ({ | ||
...prevValues, | ||
[name]: value, | ||
})); | ||
}; | ||
|
||
useEffect(() => { | ||
setIsValid(isFormValid(values)); | ||
},[values]); | ||
|
||
return ( | ||
<> | ||
<Header /> | ||
<div className="addItem"> | ||
<div className="content-container"> | ||
<form onSubmit={handleSubmit}> | ||
<div className="title-container"> | ||
<div className="title">상품 등록하기</div> | ||
<button type="submit" className="submit-button" disabled={!isValid}>등록</button> | ||
</div> | ||
<ProductImg | ||
name="imgFile" | ||
value={values.imgFile} | ||
onChange={handleChange} | ||
/> | ||
<ProductName | ||
name="name" | ||
value={values.name} | ||
onChange={handleChange} | ||
/> | ||
<ProductDescription | ||
name="description" | ||
value={values.description} | ||
onChange={handleChange} | ||
/> | ||
<ProductPrice | ||
name="price" | ||
value={values.price} | ||
onChange={handleChange} | ||
/> | ||
<ProductTag | ||
name="tags" | ||
value={values.tags} | ||
onChange={handleChange} | ||
/> | ||
</form> | ||
</div> | ||
</div> | ||
</> | ||
|
||
) | ||
} | ||
|
||
export default AddItem; |
36 changes: 36 additions & 0 deletions
36
src/pages/AddItem/components/ProductDescription/ProductDescription.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.description-container { | ||
display: flex; | ||
gap:16px; | ||
flex-direction: column; | ||
} | ||
.description { | ||
color: var(--Secondary-800, #1F2937); | ||
font-size: 18px; | ||
font-weight: 700; | ||
line-height: 26px; | ||
} | ||
.description-input { | ||
height: 282px; | ||
padding: 24px 16px; | ||
border:none; | ||
border-radius: 12px; | ||
background: var(--Cool-Gray-100, #F3F4F6); | ||
|
||
} | ||
.description-input::placeholder { | ||
color: var(--Secondary-400, #9CA3AF); | ||
font-size: 16px; | ||
font-weight: 400; | ||
line-height: 26px; | ||
|
||
align-items: top; | ||
} | ||
|
||
@media (max-width:1199px) { | ||
|
||
} | ||
|
||
/* mobile */ | ||
@media (max-width:767px) { | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/pages/AddItem/components/ProductDescription/ProductDescription.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import './ProductDescription.css'; | ||
|
||
function ProductDescription({ name, value, onChange }) { | ||
const handleChange = (e) => { | ||
onChange(name, e.target.value); | ||
}; | ||
return ( | ||
<div className='description-container'> | ||
<label className='description'>상품 소개</label> | ||
<textarea | ||
className='description-input' | ||
name={name} | ||
value={value} | ||
placeholder="상품 소개를 입력해주세요" | ||
onChange={handleChange} | ||
></textarea> | ||
</div> | ||
) | ||
} | ||
|
||
export default ProductDescription |
Oops, something went wrong.