Skip to content
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

MISSON4 / 이규민 #33

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d0af73d
첫 주차 미션
geongyu09 Mar 12, 2024
fd7bc7d
style: theme.js 설정
Klomachenko Mar 18, 2024
c11a40b
style: fontWeight 추가
Klomachenko Mar 18, 2024
1986e32
feat: create Card Component
Klomachenko Mar 18, 2024
c1afc08
chore: 절대경로 설정
Klomachenko Mar 18, 2024
c10dc18
feat: theme 중복 삭제
Klomachenko Mar 18, 2024
e35acfa
feat: Card Component 구현
Klomachenko Mar 18, 2024
5f29f23
feat: 4주차 미션을 위한 환경 설정
geongyu09 Apr 2, 2024
a8f4daa
Merge branch 'mission' of https://github.com/Klomachenko/donut-study …
Klomachenko Apr 8, 2024
b1204c2
feat: Header 구현
Klomachenko Apr 8, 2024
00f0417
feat: TabButton 구현
Klomachenko Apr 8, 2024
98709bd
feat: MainPage 구현
Klomachenko Apr 8, 2024
15e974b
feat: react-router-dom 적용
Klomachenko Apr 8, 2024
8b8dec3
feat: Item 구현
Klomachenko Apr 8, 2024
6f6b310
feat: ItemList 구현 및 fetch를 통한 item get
Klomachenko Apr 8, 2024
c8153e2
feat: DefaultButton 구현
Klomachenko Apr 8, 2024
c573874
feat: 상품 state 위치 변경
Klomachenko Apr 8, 2024
c412111
feat: onSale 세일중인 상품만 받아오기 구현
Klomachenko Apr 8, 2024
aa8013f
feat: 가격 오름차순 구현
Klomachenko Apr 8, 2024
cc7179f
feat: All 전체상품 불러오기 구현
Klomachenko Apr 8, 2024
9006616
feat: 데이터 수정
Klomachenko Apr 8, 2024
ae62b6c
delete: Card 컴포넌트 삭제
Klomachenko Apr 8, 2024
73f33d0
feat: DefaultButton props 수정
Klomachenko Apr 8, 2024
03d6d9b
style: 스타일 수정
Klomachenko Apr 8, 2024
9208497
chore: Header 컴포넌트 위치 수정에 따른 경로 변경
Klomachenko Apr 8, 2024
fd3c89e
chore: 의존성 설치 및 gitignore 설정
Klomachenko Apr 9, 2024
f84f144
feat: hooks 분리
Klomachenko Apr 9, 2024
aae09c6
chore: packageplock.json 제거
Klomachenko Apr 9, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ lerna-debug.log*
node_modules
dist
dist-ssr
jest.config.cjs
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
.babelrc
*.suo
*.ntvs*
*.njsproj
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"react-youtube": "^10.1.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 새로운 라이브러리를 사용하셨군요. 현상황에서는 단순하게 iframe으로 유튜브 영상을 삽입할 수도 있을 것 같은데 해당 라이브러리를 채택한 이유가 따로 있을까요??

},
"devDependencies": {
"@types/react": "^18.2.64",
Expand Down
44 changes: 44 additions & 0 deletions public/api/products.json
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"
}
]
30 changes: 30 additions & 0 deletions public/api/sale_products.json
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"
}
]
42 changes: 0 additions & 42 deletions src/App.css
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;
}
46 changes: 16 additions & 30 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import './App.css';
import Header from './components/organism/Header';
import MainPage from './page/MainPage';
import ShopPage from './page/ShopPage';

function App() {
const [count, setCount] = useState(0)

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>
</>
)
<div>
<BrowserRouter>
<Header />
<Routes>
<Route path='/' element={<MainPage />} />
<Route path='/shop' element={<ShopPage />} />
</Routes>
</BrowserRouter>
</div>
);
}

export default App
export default App;
Binary file added src/assets/Images/ProfileImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/Images/cart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/Images/ecnv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/Images/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/assets/react.svg

This file was deleted.

11 changes: 11 additions & 0 deletions src/components/atom/DefaultButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styles from '../../css/DefaultButton.module.css';

function DefaultButton({ buttonText, onClick }) {
return (
<button className={styles.button} onClick={onClick}>
{buttonText}
</button>
);
}
Comment on lines +3 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 상황에서는 children을 활용하는 것이 더욱 잘 읽힐 것 같은데 어떻게 생각하세요? TabButton도 마찬가지 이구요


export default DefaultButton;
7 changes: 7 additions & 0 deletions src/components/atom/TabButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styles from '../../css/TabButton.module.css';

function TabButton({ buttonText }) {
return <button className={styles.button}>{buttonText}</button>;
}

export default TabButton;
20 changes: 20 additions & 0 deletions src/components/molecule/Item.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import styles from '../../css/Item.module.css';

function Item({ product }) {
return (
<div className={styles.container}>
<div className={styles.imgBox}>
<img src={product.src} alt='상품 이미지' />
</div>
<div className={styles.infoBox}>
<h2>{product.name}</h2>
<div className={styles.priceBox}>
<h2>{product.price}</h2>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h2를 사용하신 이유가 있을 까요? html 태그의 시멘틱한 사용이 필요해보여요!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가격은 가독성을 높이기 위해서 toLocaleString()를 사용하시는 것은 어떠신가요?

<p>원</p>
</div>
</div>
</div>
);
}

export default Item;
44 changes: 44 additions & 0 deletions src/components/organism/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styles from '../../css/Header.module.css';
import ecnv from '../../assets/Images/ecnv.png';
import user from '../../assets/Images/user.png';
import cart from '../../assets/Images/cart.png';
import TabButton from '../atom/TabButton';
import { Link } from 'react-router-dom';

function Header() {
return (
<div className={styles.container}>
<div className={styles.logoWrapper}>
<Link to='/'>
<div className={styles.logoBox}>
<img src={ecnv} alt='econovation logo' />
</div>
</Link>
</div>

<div className={styles.buttonBox}>
<Link to='/shop'>
<TabButton buttonText='SHOP' />
</Link>
<TabButton buttonText='NEW ARRIVALS' />
<TabButton buttonText='BRANDS' />
<TabButton buttonText='CLOTHING' />
<TabButton buttonText='FOOTWEAR' />
<TabButton buttonText='ACCESSORIES' />
<TabButton buttonText='SALE' />
<TabButton buttonText='CONTACT' />
</div>
<div className={styles.userBox}>
<button className={styles.userButton}>
<img src={user} alt='cart icon' />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src는 user인데 alt는 cart icon이네요!

</button>
<TabButton buttonText='Log In' />
<button className={styles.cartButton}>
<img src={cart} alt='cart icon' />
</button>
</div>
</div>
);
}

export default Header;
14 changes: 14 additions & 0 deletions src/components/organism/ItemList.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styles from '../../css/ItemList.module.css';
import Item from '../molecule/Item';

function ItemList({ products }) {
return (
<div className={styles.container}>
{products.map((product) => (
<Item key={product.id} product={product} />
))}
</div>
);
}

export default ItemList;
12 changes: 12 additions & 0 deletions src/css/DefaultButton.module.css
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css폴더를 이렇게 따로 구분하신 이유가 있을까요?? 사용하시는 곳 근처에 두면 유지보수도 더 편리할 것 같아서요.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.button {
border: none;
color: black;
background-color: #eee;
font-size: 1rem;
cursor: pointer;
transition: all 0.5s;
}

.button:hover {
border-bottom: 0.0625rem solid black;
}
59 changes: 59 additions & 0 deletions src/css/Header.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.container {
width: 106.25rem;
height: 7.25rem;
background: black;
display: flex;
}

.logoWrapper {
width: 15%;
display: flex;
align-items: center;
}

.logoBox > img {
margin-left: 1.5rem;
height: 3rem;
}

.buttonBox {
width: 70%;
display: flex;
align-items: center;
justify-content: center;
}

.userBox {
width: 15%;
display: flex;
align-items: center;
justify-content: center;
}

.userBox > img {
width: 2rem;
}

.userButton {
background: black;
width: 2rem;
height: 2rem;
border-radius: 50%;
border: none;
margin-right: 1rem;
}

.userButton > img {
width: 2rem;
}

.cartButton {
width: 2rem;
height: 2rem;
background: black;
border: none;
}

.cartButton > img {
width: 2rem;
}
Loading