-
Notifications
You must be signed in to change notification settings - Fork 37
[이승환] Sprint5, 6 #304
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
The head ref may contain hidden characters: "React-\uC774\uC2B9\uD658\uD658-sprint5"
[이승환] Sprint5, 6 #304
Changes from all commits
7c19c76
581f0bd
a1086fe
9d9cf98
dbc539e
f1728c1
41c956e
521d016
a2eab7c
3b77149
5a82fec
ce99d3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
|
||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
<link rel="shortcut icon" href="../src/img/panda.png" type="image/x-icon" /> | ||
<title>판다마켓</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
|
||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
|
||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { BrowserRouter, Route, Routes } from "react-router-dom"; | ||
import App from "./components/App"; | ||
import ItemsPage from "./pages/ItemsPage"; | ||
import AddItem from "./pages/AddItem"; | ||
import BoardsPage from "./pages/BoardsPage"; | ||
|
||
function Main() { | ||
return ( | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<App />}> | ||
<Route path="/items" element={<ItemsPage />} /> | ||
<Route path="/boards" element={<BoardsPage />} /> | ||
<Route path="/additem" element={<AddItem />} /> | ||
</Route> | ||
</Routes> | ||
</BrowserRouter> | ||
); | ||
} | ||
|
||
export default Main; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export async function getList({ | ||
orderby = "recent", | ||
page = 1, | ||
pageSize = 10, | ||
keyword = "", | ||
}) { | ||
const query = `orderBy=${orderby}&page=${page}&pageSize=${pageSize}&keyword=${keyword}`; | ||
const response = await fetch( | ||
`https://panda-market-api.vercel.app/products?${query}` | ||
); | ||
const body = await response.json(); | ||
return body; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Nav from "./Nav"; | ||
import styles from "./App.module.css"; | ||
import { Outlet } from "react-router-dom"; | ||
|
||
function App() { | ||
return ( | ||
<> | ||
<Nav className={styles.nav} /> | ||
<div className={styles.body}> | ||
<Outlet /> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default App; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@font-face { | ||
font-family: "Pretendard-Regular"; | ||
src: url | ||
( | ||
"https://fastly-jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Regular.woff" | ||
) | ||
format ("woff"); | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
|
||
body { | ||
font-family: "Pretendard-Regular"; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
word-break: keep-all; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
} | ||
|
||
.nav { | ||
flex: none; | ||
} | ||
|
||
@media (max-width: 1199px) { | ||
.body { | ||
padding: 0 24px 0; | ||
} | ||
} | ||
|
||
@media (min-width: 375px) and (max-width: 767px) { | ||
.body { | ||
padding: 0 16px 0; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import styled from "styled-components"; | ||
import { ProductListItem } from "./ProductList"; | ||
|
||
const Container = styled.ul` | ||
width: 100%; | ||
max-width: 1040px; | ||
margin: 0 auto; | ||
padding: 0; | ||
display: grid; | ||
grid-template: | ||
1fr / | ||
repeat(4, 1fr); | ||
gap: 24px; | ||
list-style: none; | ||
|
||
@media (max-width: 1199px) { | ||
grid-template: | ||
1fr / | ||
repeat(2, 1fr); | ||
} | ||
|
||
@media (min-width: 375px) and (max-width: 767px) { | ||
grid-template: | ||
1fr / | ||
1fr; | ||
} | ||
`; | ||
|
||
function BestProduct({ items }) { | ||
return ( | ||
<Container> | ||
{items.map((item) => { | ||
return ( | ||
<li key={item.id}> | ||
<ProductListItem item={item} /> | ||
</li> | ||
); | ||
})} | ||
</Container> | ||
); | ||
} | ||
|
||
export default BestProduct; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { useState } from "react"; | ||
import styles from "./Dropdown.module.css"; | ||
|
||
function Dropdown({ options, selectedValue, onChange }) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const handleToggle = () => { | ||
setIsOpen((prev) => !prev); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prev 활용 좋아요~👍 |
||
}; | ||
|
||
const handleOptionClick = (value) => { | ||
onChange(value); // 부모 컴포넌트로 선택 값 전달 | ||
setIsOpen(false); | ||
}; | ||
|
||
return ( | ||
<div className={styles.dropdown}> | ||
<button | ||
className={styles.dropdown_button} | ||
onClick={handleToggle} | ||
type="button" | ||
> | ||
{options.find((option) => option.value === selectedValue)?.label || | ||
"선택"} | ||
</button> | ||
{isOpen && ( | ||
<ul className={styles.dropdown_menu}> | ||
{options.map((option) => ( | ||
<li | ||
key={option.value} | ||
className={styles.dropdown_item} | ||
onClick={() => handleOptionClick(option.value)} | ||
> | ||
{option.label} | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default Dropdown; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropdown은 만들고 사용하는 곳은 없나요? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 24px
과 결과가 동일해서 확인하면 좋을 것 같아요.