Skip to content

Commit d7fef37

Browse files
authored
Merge pull request #117 from SanginJeong/React-정상인-sprint7
[정상인] sprint7
2 parents 4cd342b + c5a838b commit d7fef37

File tree

51 files changed

+880
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+880
-147
lines changed

vite-project/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading

vite-project/src/App.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
--primary200: #1967d6;
44
--primary300: #1251aa;
55

6+
--secondary200: #e5e7eb;
7+
--secondary300: #e5e7eb;
8+
--secondary400: #9ca3af;
9+
--secondary500: #6b7280;
10+
--secondary600: #4b5563;
11+
--secondary800: #1f2937;
12+
613
--gray50: #f9fafb;
714
--gray100: #f3f4f6;
815
--gray200: #e5e7eb;
16+
--gray300: #d1d5db;
917
--gray400: #9ca3af;
1018
--gray500: #6b7280;
1119
--gray600: #4b5563;
@@ -70,8 +78,10 @@ p {
7078
}
7179

7280
.btn-medium {
81+
width: 240px;
7382
height: 48px;
74-
padding: 12px 71px;
83+
padding: 12px 64px;
84+
white-space: nowrap;
7585
border-radius: 40px;
7686
border: none;
7787
font-weight: 600;
@@ -117,6 +127,12 @@ p {
117127
align-items: center;
118128
}
119129

130+
.kebab-btn {
131+
display: flex;
132+
justify-content: center;
133+
align-items: center;
134+
}
135+
120136
.container {
121137
max-width: 1200px;
122138
margin: 0 auto;

vite-project/src/App.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import "./App.css";
22
import { Route, Routes, Navigate } from "react-router";
3-
import ItemsPage from "./pages/ItemsPage";
4-
import AddItemPage from "./pages/AddItemPage";
3+
import ProductsPage from "./pages/ProductsPage";
4+
import AddProductPage from "./pages/AddProductPage";
55
import Layout from "./layout/Layout";
66
import FreeBoard from "./pages/FreeBoardPage";
7+
import ProductDetailPage from "./pages/ProductDetailPage";
78

89
function App() {
910
return (
@@ -12,10 +13,13 @@ function App() {
1213
<Route path="/" element={<Navigate to="/items" />} />
1314

1415
<Route element={<Layout />}>
15-
<Route path="/items" element={<ItemsPage />} />
16-
<Route path="/addItem" element={<AddItemPage />} />
16+
<Route path="/items">
17+
<Route index element={<ProductsPage />} />
18+
<Route path=":productId" element={<ProductDetailPage />} />
19+
</Route>
20+
<Route path="/addItem" element={<AddProductPage />} />
1721
{/* freeBoard : link active 테스트를 위해 미리 만듦 */}
18-
<Route path="/freeBoard" element={<FreeBoard />} />{" "}
22+
<Route path="/freeBoard" element={<FreeBoard />} />
1923
</Route>
2024
</Routes>
2125
);
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import React, { useState } from "react";
1+
const DropDown = ({ children, className }) => {
2+
return <div className={`dropdown ${className}`}>{children}</div>;
3+
};
24

3-
const DropDown = ({ children }) => {
4-
return <div className="dropdown">{children}</div>;
5+
DropDown.header = ({ children }) => {
6+
return <div>{children}</div>;
57
};
68

7-
DropDown.header = ({ children, onClick }) => {
9+
DropDown.menus = ({ children, isOpen, className }) => {
810
return (
9-
<button onClick={onClick} className="button dropdown-btn">
10-
{children}
11-
</button>
11+
isOpen && <ul className={`dropdown-menus ${className}`}>{children}</ul>
1212
);
1313
};
1414

15-
DropDown.menus = ({ children, isOpen }) => {
16-
return isOpen && <ul className="dropdown-menus">{children}</ul>;
17-
};
18-
1915
export default DropDown;

vite-project/src/common/ProductCard/index.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import "./ProductCard.style.css";
32

43
const ProductCard = ({ product, category }) => {

vite-project/src/common/ProductList/index.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import React from "react";
21
import { Link } from "react-router";
32
import ProductCard from "../ProductCard";
43
const ProductList = ({ products, className }) => {
54
return (
65
<ul className={className}>
76
{products?.map((product) => (
87
<li key={product.id}>
9-
<Link>
8+
<Link to={`${product.id}`}>
109
<ProductCard product={product} category="all-card-img" />
1110
</Link>
1211
</li>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { useEffect } from "react";
2+
import { useLocation } from "react-router";
3+
4+
const ScrollToTop = () => {
5+
const { pathname } = useLocation();
6+
7+
useEffect(() => {
8+
window.scrollTo(0, 0);
9+
}, [pathname]);
10+
11+
return null;
12+
};
13+
14+
export default ScrollToTop;

0 commit comments

Comments
 (0)