Skip to content

[김가희] sprint6 #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 115 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"react-dom": "^18.2.0",
"react-router-dom": "^6.26.1",
"react-scripts": "5.0.1",
"styled-components": "^6.1.13",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
46 changes: 28 additions & 18 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,35 @@
* @returns
*/
export async function getItems(
page = 1,
pageSize = 10,
orderBy = "recent",
keyword

page = 1,
pageSize = 10,
orderBy = "recent",
keyword
) {
const searchQuery = keyword ? `keyword=${keyword}` : "";
const response = await fetch(
`https://panda-market-api.vercel.app/products?page=${page}&pageSize=${pageSize}&orderBy=${orderBy}&${searchQuery}`
);
const body = await response.json();
return body;
const searchQuery = keyword ? `keyword=${keyword}` : "";
const response = await fetch(
`https://panda-market-api.vercel.app/products?page=${page}&pageSize=${pageSize}&orderBy=${orderBy}&${searchQuery}`
);
const body = await response.json();
return body;
}



export async function addItem(requestBody) {
const response = await fetch("https://panda-market-api.vercel.app/products", {
method: "POST",
body: JSON.stringify({
images: requestBody.images,
tags: requestBody.tags,
price: requestBody.price,
description: requestBody.description,
name: requestBody.name,
}),
});
return response;
}

// // 1페이지 10개 최신순 줘
// const 1페이지10개 = getItems(1,10,"recent")
// const 2페이지10개 = getItems(2,10,"recent")
// const 3페이지10개 = getItems(3,10,"recent")

// // 최신순으로 1페이지 1개 줘
// const 1페이지10개 = getItems(1,10,"favorite")
// const 2페이지10개 = getItems(2,10,"favorite")
// const 3페이지10개 = getItems(3,10,"favorite")

13 changes: 7 additions & 6 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Nav from "./Nav";


function App({ children }) {
return (
<div>
<Nav></Nav>
<div>{children}</div>
</div>
);
return (
<div>
<Nav></Nav>
<div>{children}</div>
</div>
);
}

export default App;
10 changes: 10 additions & 0 deletions src/components/addItem/ItemInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const ItemInfo = () => {
return(
<>
<h1>상품 소개</h1>
<textarea placeholder="상품 소개를 입력해주세요"></textarea>
</>
)
};

export default ItemInfo;
10 changes: 10 additions & 0 deletions src/components/addItem/ItemName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const ItemName = () => {
return(
<>
<h1>상품명</h1>
<textarea placeholder="상품명을 입력해주세요"></textarea>
</>
)
}

export default ItemName;
11 changes: 11 additions & 0 deletions src/components/addItem/UploadImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const UploadImage = () => {
return(
<>
<h2>상품 이미지</h2>
<h2>이미지 박스(임의)</h2>
</>
)
}


export default UploadImage;
30 changes: 30 additions & 0 deletions src/components/addItem/UploadItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import style from "styled-components";



const Upload = style.div`
display: flex;
justify-content: space-between;
`;

const UploadText = style.div``

const Button = style.button`
width: 74px;
height: 42px;
border: 1px solid #9CA3AF;
border-radius: 8px;
`;

const UploadItem = () => {
return (
<>
<Upload>
<UploadText>상품 등록하기</UploadText>
<Button>등록</Button>
</Upload>
</>
);
};

export default UploadItem;
Loading
Loading