-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from jangyonghan/React-장용한-sprint8
[장용한]sprint8
- Loading branch information
Showing
35 changed files
with
3,036 additions
and
2,628 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
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
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,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
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,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
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 was deleted.
Oops, something went wrong.
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,29 @@ | ||
interface Produect { | ||
id: number; | ||
name: string; | ||
price: number; | ||
description: string; | ||
images: string; | ||
createdAt: string; | ||
favoriteCount: number; | ||
tags: string; | ||
} | ||
|
||
interface ProduectList { | ||
list: Produect[]; | ||
} | ||
|
||
export async function getProducts( | ||
pageSize = 10, | ||
orderBy = "recent" | ||
): Promise<ProduectList> { | ||
const query = `pageSize=${pageSize}&orderBy=${orderBy}`; | ||
const response = await fetch( | ||
`https://panda-market-api.vercel.app/products?${query}` | ||
); | ||
if (!response.ok) { | ||
throw new Error("제품을 불러오는데 실패했습니다"); | ||
} | ||
const result = await response.json(); | ||
return result; | ||
} |
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
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,19 +1,13 @@ | ||
import React from "react"; | ||
import { ReactComponent as LeftArrow } from "../../images/icons/arrow_left.svg"; | ||
import { ReactComponent as RightArrow } from "../../images/icons/arrow_right.svg"; | ||
|
||
|
||
|
||
function PaginationBar () { | ||
|
||
return( | ||
<div> | ||
<LeftArrow/> | ||
<RightArrow/> | ||
</div> | ||
|
||
); | ||
function PaginationBar() { | ||
return ( | ||
<div> | ||
<LeftArrow /> | ||
<RightArrow /> | ||
</div> | ||
); | ||
} | ||
|
||
export default PaginationBar; | ||
|
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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
interface DropdownListProps { | ||
onSortSelection: (type: string) => void; | ||
} | ||
|
||
const DropdownList = ({ onSortSelection }: DropdownListProps) => { | ||
return ( | ||
<div className="dropdownList"> | ||
<div className="dropdownItem" onClick={() => onSortSelection("recent")}> | ||
최신순 | ||
</div> | ||
<div className="dropdownItem" onClick={() => onSortSelection("favorite")}> | ||
인기순 | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DropdownList; |
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
import React, { createContext, useState, useEffect, ReactNode } from "react"; | ||
import { getProducts } from "../API/ItemAPI"; | ||
|
||
interface Product { | ||
id: number; | ||
name: string; | ||
price: number; | ||
description: string; | ||
images: string; | ||
createdAt: string; | ||
favoriteCount: number; | ||
tags: string; | ||
} | ||
|
||
interface ItemProviderPropt { | ||
children: ReactNode; | ||
} | ||
|
||
export const ItemContext = createContext<Product[]>([]); | ||
|
||
export const ItemProvider: React.FC<ItemProviderPropt> = ({ children }) => { | ||
const [itemList, setItemList] = useState<Product[]>([]); | ||
|
||
useEffect(() => { | ||
const fetchAndProcessData = async () => { | ||
try { | ||
const data = await getProducts(); | ||
setItemList(data.list); | ||
} catch (error) { | ||
console.error("데이터를 가져오지 못했습니다", error); | ||
} | ||
}; | ||
fetchAndProcessData(); | ||
}, []); | ||
|
||
return ( | ||
<ItemContext.Provider value={itemList}>{children}</ItemContext.Provider> | ||
); | ||
}; |
Oops, something went wrong.