-
Notifications
You must be signed in to change notification settings - Fork 8
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
Mission4 / 강하은 #30
base: main
Are you sure you want to change the base?
Mission4 / 강하은 #30
Changes from all commits
1530631
63815e6
c61d164
5f7f8f0
30abe81
0320e37
ce3d751
8c7abce
e79be5d
eed2360
55feeaf
9a89353
d5b82de
d0386e3
6f33fc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"src": "https://img.freepik.com/free-photo/jeans_1203-8092.jpg", | ||
"name": "무시무시한바지", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 2, | ||
"src": "https://img.freepik.com/free-psd/jerzees-pullover-hooded-sweatshirt-mockup-01_126278-94.jpg?w=1480&t=st=1712066977~exp=1712067577~hmac=e2134a114b35532277ab0c2b76ae698527139f0b46b345c0caa0e9aa3d66cd33", | ||
"name": "후드티", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 3, | ||
"src": "https://img.freepik.com/free-photo/basic-white-tee-women-s-apparel-rear-view_53876-108033.jpg?t=st=1712067014~exp=1712070614~hmac=7f176e8ed6876ac7593cb0bf2cc392ede4372858b1fec4bb3e585546753bea02&w=1380", | ||
"name": "반팔 티", | ||
"price": "200000₩", | ||
"isSale": "false" | ||
}, | ||
{ | ||
"id": 4, | ||
"src": "https://img.freepik.com/free-photo/background-textile-protection-back-object_1203-6405.jpg?t=st=1712067043~exp=1712070643~hmac=30c53d8fcb2e8a6d516b952a2f0b1df44ee66af6ec82856ec8f0e676db9b5c8e&w=1060", | ||
"name": "볼 캡 (야구모자)", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 5, | ||
"src": "https://img.freepik.com/free-photo/still-life-rendering-jackets-display_23-2149745031.jpg?t=st=1712067097~exp=1712070697~hmac=2a020243be6e84e0541f2292493bb00dd13ea328e50021ceff86fa567e5fab95&w=2000", | ||
"name": "가죽 자켓", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 6, | ||
"src": "https://img.freepik.com/free-vector/all-types-black-white-socks-sports-every-day-realistic-set-isolated-vector-illustration_1284-73137.jpg?t=st=1712067118~exp=1712070718~hmac=d5bc8f8b274ebd67d98d0bfa02db9e530818eb49b18a7ed13fa3751f26737dae&w=2000", | ||
"name": "양말", | ||
"price": "200000₩", | ||
"isSale": "false" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"src": "https://img.freepik.com/free-photo/jeans_1203-8092.jpg", | ||
"name": "무시무시한바지", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 2, | ||
"src": "https://img.freepik.com/free-psd/jerzees-pullover-hooded-sweatshirt-mockup-01_126278-94.jpg?w=1480&t=st=1712066977~exp=1712067577~hmac=e2134a114b35532277ab0c2b76ae698527139f0b46b345c0caa0e9aa3d66cd33", | ||
"name": "후드티", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 4, | ||
"src": "https://img.freepik.com/free-photo/background-textile-protection-back-object_1203-6405.jpg?t=st=1712067043~exp=1712070643~hmac=30c53d8fcb2e8a6d516b952a2f0b1df44ee66af6ec82856ec8f0e676db9b5c8e&w=1060", | ||
"name": "볼 캡 (야구모자)", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
}, | ||
{ | ||
"id": 5, | ||
"src": "https://img.freepik.com/free-photo/still-life-rendering-jackets-display_23-2149745031.jpg?t=st=1712067097~exp=1712070697~hmac=2a020243be6e84e0541f2292493bb00dd13ea328e50021ceff86fa567e5fab95&w=2000", | ||
"name": "가죽 자켓", | ||
"price": "500000₩", | ||
"isSale": "true" | ||
} | ||
] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +0,0 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} | ||
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,35 +1,74 @@ | ||||||
import { useState } from 'react' | ||||||
import reactLogo from './assets/react.svg' | ||||||
import viteLogo from '/vite.svg' | ||||||
import './App.css' | ||||||
import { useState, useEffect } from "react"; | ||||||
import Image from "./assets/Image.jpg"; | ||||||
import styled from "styled-components"; | ||||||
import axios from "axios"; | ||||||
|
||||||
function App() { | ||||||
const [count, setCount] = useState(0) | ||||||
const [products, setProducts] = useState([]); | ||||||
const [currentView, setCurrentView] = useState("All product"); | ||||||
|
||||||
useEffect(() => { | ||||||
axios | ||||||
.get( | ||||||
`api/${ | ||||||
currentView === "All product" ? "products.json" : "sale_products.json" | ||||||
}` | ||||||
) | ||||||
.then((res) => { | ||||||
setProducts(res.data); | ||||||
}) | ||||||
.catch((error) => { | ||||||
console.error("상품 데이터를 불러오는 중 오류가 발생했습니다.", error); | ||||||
}); | ||||||
}, [currentView]); | ||||||
return ( | ||||||
<> | ||||||
<div> | ||||||
<a href="https://vitejs.dev" target="_blank"> | ||||||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||||||
</a> | ||||||
<a href="https://react.dev" target="_blank"> | ||||||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||||||
</a> | ||||||
</div> | ||||||
<h1>Vite + React</h1> | ||||||
<div className="card"> | ||||||
<button onClick={() => setCount((count) => count + 1)}> | ||||||
count is {count} | ||||||
</button> | ||||||
<p> | ||||||
Edit <code>src/App.jsx</code> and save to test HMR | ||||||
</p> | ||||||
</div> | ||||||
<p className="read-the-docs"> | ||||||
Click on the Vite and React logos to learn more | ||||||
</p> | ||||||
<img src={Image} style={{ width: "100%" }} /> | ||||||
<ProductFrame> | ||||||
{ | ||||||
<Button | ||||||
onClick={() => { | ||||||
setCurrentView( | ||||||
currentView === "Sale product" ? "All product" : "Sale product" | ||||||
); | ||||||
}} | ||||||
> | ||||||
{currentView === "All product" ? "All product" : "Sale product"} | ||||||
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.
Suggested change
로 쓸수 있나요?? |
||||||
</Button> | ||||||
} | ||||||
<ProductList> | ||||||
{products.map((product) => ( | ||||||
<div key={product.id}> | ||||||
<img src={product.src} style={{ width: "100%" }} /> | ||||||
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. styled-component를 사용하지 않고 inline style을 준 이유가 있나요? |
||||||
<div>{product.name}</div> | ||||||
<div>{product.price}</div> | ||||||
</div> | ||||||
))} | ||||||
</ProductList> | ||||||
</ProductFrame> | ||||||
</> | ||||||
) | ||||||
); | ||||||
} | ||||||
|
||||||
export default App | ||||||
export default App; | ||||||
|
||||||
const ProductFrame = styled.div` | ||||||
padding: 1.5rem; | ||||||
`; | ||||||
const ProductList = styled.div` | ||||||
display: flex; | ||||||
gap: 5rem; | ||||||
flex-wrap: wrap; | ||||||
padding: 1rem; | ||||||
& > div { | ||||||
width: calc((100% - 10rem) / 3); | ||||||
} | ||||||
`; | ||||||
|
||||||
const Button = styled.button` | ||||||
border: none; | ||||||
border-radius: 1rem; | ||||||
font-size: 1.5rem; | ||||||
width: auto; | ||||||
height: 3rem; | ||||||
`; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +0,0 @@ | ||
:root { | ||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
|
||
color-scheme: light dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
a:hover { | ||
color: #535bf2; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
place-items: center; | ||
min-width: 320px; | ||
min-height: 100vh; | ||
} | ||
|
||
h1 { | ||
font-size: 3.2em; | ||
line-height: 1.1; | ||
} | ||
|
||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s; | ||
} | ||
button:hover { | ||
border-color: #646cff; | ||
} | ||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
color: #213547; | ||
background-color: #ffffff; | ||
} | ||
a:hover { | ||
color: #747bff; | ||
} | ||
button { | ||
background-color: #f9f9f9; | ||
} | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App.jsx' | ||
import './index.css' | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App.jsx"; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')).render( | ||
ReactDOM.createRoot(document.getElementById("root")).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
) | ||
</React.StrictMode> | ||
); |
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.
#29 (comment)
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.
#29 (comment)
(위와 다른 코멘트입니다.)