diff --git a/.gitignore b/.gitignore
index 4d29575d..fa91df69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,8 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+
+# reference files
+src/pages/MeetingRoomFive.js
+src/pages/Registration(TaejinLiveShare).js
+src/pages/ApiComparisonTest.js
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 3801cda6..c100f3a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,6 +15,7 @@
"react-dom": "^18.3.1",
"react-router-dom": "^6.27.0",
"react-scripts": "5.0.1",
+ "styled-components": "^6.1.13",
"web-vitals": "^2.1.4"
}
},
@@ -2380,6 +2381,27 @@
"postcss-selector-parser": "^6.0.10"
}
},
+ "node_modules/@emotion/is-prop-valid": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.2.tgz",
+ "integrity": "sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==",
+ "license": "MIT",
+ "dependencies": {
+ "@emotion/memoize": "^0.8.1"
+ }
+ },
+ "node_modules/@emotion/memoize": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz",
+ "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==",
+ "license": "MIT"
+ },
+ "node_modules/@emotion/unitless": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz",
+ "integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==",
+ "license": "MIT"
+ },
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -4782,6 +4804,12 @@
"integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==",
"license": "MIT"
},
+ "node_modules/@types/stylis": {
+ "version": "4.2.5",
+ "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz",
+ "integrity": "sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==",
+ "license": "MIT"
+ },
"node_modules/@types/testing-library__jest-dom": {
"version": "5.14.9",
"resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.9.tgz",
@@ -6375,6 +6403,15 @@
"node": ">= 6"
}
},
+ "node_modules/camelize": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz",
+ "integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/caniuse-api": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
@@ -6848,6 +6885,15 @@
"postcss": "^8.4"
}
},
+ "node_modules/css-color-keywords": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz",
+ "integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/css-declaration-sorter": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz",
@@ -6997,6 +7043,17 @@
"integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==",
"license": "MIT"
},
+ "node_modules/css-to-react-native": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz",
+ "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==",
+ "license": "MIT",
+ "dependencies": {
+ "camelize": "^1.0.0",
+ "css-color-keywords": "^1.0.0",
+ "postcss-value-parser": "^4.0.2"
+ }
+ },
"node_modules/css-tree": {
"version": "1.0.0-alpha.37",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz",
@@ -17159,6 +17216,12 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
+ "node_modules/shallowequal": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz",
+ "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==",
+ "license": "MIT"
+ },
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -17775,6 +17838,68 @@
"webpack": "^5.0.0"
}
},
+ "node_modules/styled-components": {
+ "version": "6.1.13",
+ "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.13.tgz",
+ "integrity": "sha512-M0+N2xSnAtwcVAQeFEsGWFFxXDftHUD7XrKla06QbpUMmbmtFBMMTcKWvFXtWxuD5qQkB8iU5gk6QASlx2ZRMw==",
+ "license": "MIT",
+ "dependencies": {
+ "@emotion/is-prop-valid": "1.2.2",
+ "@emotion/unitless": "0.8.1",
+ "@types/stylis": "4.2.5",
+ "css-to-react-native": "3.2.0",
+ "csstype": "3.1.3",
+ "postcss": "8.4.38",
+ "shallowequal": "1.1.0",
+ "stylis": "4.3.2",
+ "tslib": "2.6.2"
+ },
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/styled-components"
+ },
+ "peerDependencies": {
+ "react": ">= 16.8.0",
+ "react-dom": ">= 16.8.0"
+ }
+ },
+ "node_modules/styled-components/node_modules/postcss": {
+ "version": "8.4.38",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz",
+ "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.7",
+ "picocolors": "^1.0.0",
+ "source-map-js": "^1.2.0"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/styled-components/node_modules/tslib": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
+ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
+ "license": "0BSD"
+ },
"node_modules/stylehacks": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.1.tgz",
@@ -17791,6 +17916,12 @@
"postcss": "^8.2.15"
}
},
+ "node_modules/stylis": {
+ "version": "4.3.2",
+ "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz",
+ "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==",
+ "license": "MIT"
+ },
"node_modules/sucrase": {
"version": "3.35.0",
"resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz",
diff --git a/package.json b/package.json
index 96059456..1ab9a905 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"react-dom": "^18.3.1",
"react-router-dom": "^6.27.0",
"react-scripts": "5.0.1",
+ "styled-components": "^6.1.13",
"web-vitals": "^2.1.4"
},
"scripts": {
diff --git a/public/logo192.png b/public/logo192.png
deleted file mode 100644
index fc44b0a3..00000000
Binary files a/public/logo192.png and /dev/null differ
diff --git a/public/logo512.png b/public/logo512.png
deleted file mode 100644
index a4e47a65..00000000
Binary files a/public/logo512.png and /dev/null differ
diff --git a/public/manifest.json b/public/manifest.json
deleted file mode 100644
index 080d6c77..00000000
--- a/public/manifest.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "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"
-}
diff --git a/public/robots.txt b/public/robots.txt
deleted file mode 100644
index e9e57dc4..00000000
--- a/public/robots.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-# https://www.robotstxt.org/robotstxt.html
-User-agent: *
-Disallow:
diff --git a/src/assets/font/Pretendard-Regular.woff b/public/static/font/Pretendard-Regular.woff
similarity index 100%
rename from src/assets/font/Pretendard-Regular.woff
rename to public/static/font/Pretendard-Regular.woff
diff --git a/src/assets/font/ROKAF_Sans_Bold.ttf b/public/static/font/ROKAF_Sans_Bold.ttf
similarity index 100%
rename from src/assets/font/ROKAF_Sans_Bold.ttf
rename to public/static/font/ROKAF_Sans_Bold.ttf
diff --git a/src/assets/font/ROKAF_Sans_Medium.ttf b/public/static/font/ROKAF_Sans_Medium.ttf
similarity index 100%
rename from src/assets/font/ROKAF_Sans_Medium.ttf
rename to public/static/font/ROKAF_Sans_Medium.ttf
diff --git a/public/static/images/Img_home_01.png b/public/static/images/Img_home_01.png
new file mode 100644
index 00000000..0801379a
Binary files /dev/null and b/public/static/images/Img_home_01.png differ
diff --git a/public/static/images/Img_home_02.png b/public/static/images/Img_home_02.png
new file mode 100644
index 00000000..5622cb4e
Binary files /dev/null and b/public/static/images/Img_home_02.png differ
diff --git a/public/static/images/Img_home_03.png b/public/static/images/Img_home_03.png
new file mode 100644
index 00000000..80367c2f
Binary files /dev/null and b/public/static/images/Img_home_03.png differ
diff --git a/public/static/images/Img_home_bottom.png b/public/static/images/Img_home_bottom.png
new file mode 100644
index 00000000..cbb3b018
Binary files /dev/null and b/public/static/images/Img_home_bottom.png differ
diff --git a/public/static/images/Img_home_top.png b/public/static/images/Img_home_top.png
new file mode 100644
index 00000000..b6d30fe0
Binary files /dev/null and b/public/static/images/Img_home_top.png differ
diff --git a/public/favicon.png b/public/static/images/favicon.png
similarity index 100%
rename from public/favicon.png
rename to public/static/images/favicon.png
diff --git a/public/static/images/google.png b/public/static/images/google.png
new file mode 100644
index 00000000..914c0dbb
Binary files /dev/null and b/public/static/images/google.png differ
diff --git a/public/static/images/hide-pw.png b/public/static/images/hide-pw.png
new file mode 100644
index 00000000..ebe01375
Binary files /dev/null and b/public/static/images/hide-pw.png differ
diff --git a/src/assets/images/ic_facebook.svg b/public/static/images/ic_facebook.svg
similarity index 100%
rename from src/assets/images/ic_facebook.svg
rename to public/static/images/ic_facebook.svg
diff --git a/src/assets/images/ic_instagram.svg b/public/static/images/ic_instagram.svg
similarity index 100%
rename from src/assets/images/ic_instagram.svg
rename to public/static/images/ic_instagram.svg
diff --git a/public/static/images/ic_sort.png b/public/static/images/ic_sort.png
new file mode 100644
index 00000000..9292d758
Binary files /dev/null and b/public/static/images/ic_sort.png differ
diff --git a/src/assets/images/ic_twitter.svg b/public/static/images/ic_twitter.svg
similarity index 100%
rename from src/assets/images/ic_twitter.svg
rename to public/static/images/ic_twitter.svg
diff --git a/public/static/images/ic_x.png b/public/static/images/ic_x.png
new file mode 100644
index 00000000..60c7748f
Binary files /dev/null and b/public/static/images/ic_x.png differ
diff --git a/src/assets/images/ic_youtube.svg b/public/static/images/ic_youtube.svg
similarity index 100%
rename from src/assets/images/ic_youtube.svg
rename to public/static/images/ic_youtube.svg
diff --git a/public/static/images/kakao.png b/public/static/images/kakao.png
new file mode 100644
index 00000000..61120754
Binary files /dev/null and b/public/static/images/kakao.png differ
diff --git a/src/assets/images/like-icon.png b/public/static/images/like-icon.png
similarity index 100%
rename from src/assets/images/like-icon.png
rename to public/static/images/like-icon.png
diff --git a/public/static/images/login-logo.png b/public/static/images/login-logo.png
new file mode 100644
index 00000000..4c538949
Binary files /dev/null and b/public/static/images/login-logo.png differ
diff --git a/src/assets/images/logo.png b/public/static/images/logo.png
similarity index 100%
rename from src/assets/images/logo.png
rename to public/static/images/logo.png
diff --git a/public/static/images/og-image.jpg b/public/static/images/og-image.jpg
new file mode 100644
index 00000000..f2274f31
Binary files /dev/null and b/public/static/images/og-image.jpg differ
diff --git a/src/assets/images/page_left_arrow.png b/public/static/images/page_left_arrow.png
similarity index 100%
rename from src/assets/images/page_left_arrow.png
rename to public/static/images/page_left_arrow.png
diff --git a/src/assets/images/page_right_arrow.png b/public/static/images/page_right_arrow.png
similarity index 100%
rename from src/assets/images/page_right_arrow.png
rename to public/static/images/page_right_arrow.png
diff --git a/src/assets/images/search.png b/public/static/images/search.png
similarity index 100%
rename from src/assets/images/search.png
rename to public/static/images/search.png
diff --git a/public/static/images/show-pw.png b/public/static/images/show-pw.png
new file mode 100644
index 00000000..d3c77474
Binary files /dev/null and b/public/static/images/show-pw.png differ
diff --git a/public/static/images/user_profile.png b/public/static/images/user_profile.png
new file mode 100644
index 00000000..c58d418f
Binary files /dev/null and b/public/static/images/user_profile.png differ
diff --git a/src/App.css b/src/App.css
index 7f2dc4e4..589de354 100644
--- a/src/App.css
+++ b/src/App.css
@@ -1,13 +1,13 @@
@font-face {
- font-family: 'Pretendard-Regular';
- src: url('./assets/font/Pretendard-Regular.woff') format('woff');
+ font-family: "Pretendard-Regular";
+ src: url("/public/static/font/Pretendard-Regular.woff") format("woff");
font-weight: 400;
font-style: normal;
}
@font-face {
- font-family: 'rokaf';
- src: url('./assets/font/ROKAF_Sans_Medium.ttf') format('truetype');
+ font-family: "rokaf";
+ src: url("/public/static/font/ROKAF_Sans_Medium.ttf") format("truetype");
}
* {
@@ -24,4 +24,14 @@ html {
a {
text-decoration: none;
color: inherit;
-}
\ No newline at end of file
+}
+
+.coming_soon {
+ height: calc(100vh - 230px);
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 5rem;
+ font-weight: 700;
+ color: #3692ff;
+}
diff --git a/src/App.js b/src/App.js
index 868ae492..fdef5c9d 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,15 +1,47 @@
-import Nav from './components/Nav/Nav'
-import Main from './components/Main/Main'
-import Footer from './components/Footer/Footer'
-import './App.css'
+import { BrowserRouter as Router, Route, Routes, useLocation } from 'react-router-dom';
+import Nav from './components/Nav/Nav';
+import Footer from './components/Footer/Footer';
+import Main from './pages/Main';
+import Login from './pages/Login';
+import Signup from './pages/Signup';
+import Items from './pages/Items';
+import Community from './pages/Community';
+import Faq from './pages/Faq';
+import Privacy from './pages/Privacy';
+import Registration from './pages/Registration';
+// import ApiComparisonTest from './pages/ApiComparisonTest';
+import './App.css';
+
+function AppContent() {
+ const location = useLocation();
+
+ // Nav와 Footer를 제외할 경로 목록
+ const hideHeaderFooterPaths = ['/login', '/signup'];
+
+ return (
+ <>
+ {!hideHeaderFooterPaths.includes(location.pathname) && }
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ {/* } /> */}
+
+ {!hideHeaderFooterPaths.includes(location.pathname) && }
+ >
+ );
+}
function App() {
return (
-
-
-
-
-
+
+
+
);
}
diff --git a/src/apis/ProductService(MongoDB).js b/src/apis/ProductService(MongoDB).js
new file mode 100644
index 00000000..816a8b51
--- /dev/null
+++ b/src/apis/ProductService(MongoDB).js
@@ -0,0 +1,42 @@
+const BASE_URL = 'http://localhost:8000/api/products';
+
+export async function getProductList(offset, limit, orderBy, keyword) {
+ const params = new URLSearchParams({
+ offset,
+ limit,
+ orderBy,
+ keyword,
+ });
+
+ const url = `${BASE_URL}?${params}`;
+
+ try {
+ const response = await fetch(url);
+
+ if (!response.ok) {
+ throw new Error(`지정 에러: ${response.status} - ${response.statusText}`); // 내가 지정한 오류 핸들링
+ }
+
+ const data = await response.json();
+ return data;
+
+ } catch (error) {
+ console.error("기타 에러:", error); // 서버 등 예측하지 못한 에러 위해
+ }
+}
+
+export async function registerProduct(productData) {
+ try {
+ const response = await fetch(BASE_URL, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(productData),
+ });
+ if (!response.ok) {
+ throw new Error(`등록 실패: ${response.status}`);
+ }
+ return await response.json();
+ } catch (error) {
+ console.error("상품 등록 중 오류:", error);
+ }
+}
\ No newline at end of file
diff --git a/src/apis/ProductService.js b/src/apis/ProductService.js
index 65c257e7..327982ac 100644
--- a/src/apis/ProductService.js
+++ b/src/apis/ProductService.js
@@ -18,7 +18,7 @@ export async function getProductList(page, pageSize, orderBy, keyword) {
}
const data = await response.json();
- console.log(data);
+ // console.log(data);
return data;
} catch (error) {
diff --git a/src/assets/images/placeholder.png b/src/assets/images/placeholder.png
index 950411c3..be078e13 100644
Binary files a/src/assets/images/placeholder.png and b/src/assets/images/placeholder.png differ
diff --git a/src/components/Footer/Footer.js b/src/components/Footer/Footer.js
index f13a72de..50ae1ae3 100644
--- a/src/components/Footer/Footer.js
+++ b/src/components/Footer/Footer.js
@@ -1,9 +1,6 @@
import React from 'react';
+import { Link } from 'react-router-dom';
import styles from './Footer.module.css'
-import facebook from '../../assets/images/ic_facebook.svg'
-import twitter from '../../assets/images/ic_twitter.svg'
-import youtube from '../../assets/images/ic_youtube.svg'
-import instagram from '../../assets/images/ic_instagram.svg'
function Footer() {
return (
@@ -11,14 +8,22 @@ function Footer() {
©codeit - 2024
- Privacy Policy
- FAQ
+ Privacy Policy
+ FAQ
diff --git a/src/components/Footer/Footer.module.css b/src/components/Footer/Footer.module.css
index 01480cba..8a53223e 100644
--- a/src/components/Footer/Footer.module.css
+++ b/src/components/Footer/Footer.module.css
@@ -13,15 +13,31 @@
line-height: 19.09px;
display: flex;
justify-content: space-between;
+ position: relative;
+ /* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+ @media (min-width: 744px) and (max-width: 1199.98px) {
+ padding: 0 24px;
+ }
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ padding: 0 24px;
+ }
}
.copy {
- color: #9CA3AF;
+ color: #9ca3af;
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ padding: 0 24px;
+ position: absolute;
+ left: 0;
+ bottom: -33px;
+ }
}
.info {
width: 145px;
- color: #E5E7EB;
+ color: #e5e7eb;
display: flex;
justify-content: space-between;
}
@@ -38,4 +54,4 @@
.sns > span {
cursor: pointer;
-}
\ No newline at end of file
+}
diff --git a/src/components/Main/HeroSection.js b/src/components/Main/HeroSection.js
new file mode 100644
index 00000000..fa6d9d51
--- /dev/null
+++ b/src/components/Main/HeroSection.js
@@ -0,0 +1,21 @@
+import React from 'react'
+import { Link } from 'react-router-dom';
+import styles from './HeroSection.module.css'
+
+function HeroSection() {
+ return (
+
+
+
+
일상의 모든 물건을
거래해 보세요
+
+
구경하러 가기
+
+
+
+
+
+ )
+}
+
+export default HeroSection
\ No newline at end of file
diff --git a/src/components/Main/HeroSection.module.css b/src/components/Main/HeroSection.module.css
new file mode 100644
index 00000000..09b9862a
--- /dev/null
+++ b/src/components/Main/HeroSection.module.css
@@ -0,0 +1,87 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) and (max-width: 1440px) {
+ section.hero_section {
+ height: calc(540px - 108px);
+ }
+ div.hero_box {
+ transform: scale(0.75);
+ transform-origin: center bottom;
+ }
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+ section.hero_section {
+ height: calc(540px - 216px);
+ }
+ div.hero_box {
+ transform: scale(0.6);
+ transform-origin: center bottom;
+ }
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+ section.hero_section {
+ height: calc(540px - 180px);
+ }
+ div.hero_box {
+ height: 600px;
+ width: 400px;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: center;
+ position: absolute;
+ bottom: 0;
+ transform: scale(0.5);
+ transform-origin: center bottom;
+ }
+}
+
+.hero_section {
+ width: 100%;
+ height: 540px;
+ background-color: #cfe5ff;
+ display: flex;
+ justify-content: center;
+ align-items: flex-end;
+ position: relative;
+}
+
+.hero_box {
+ width: 1110px;
+ height: 340px;
+ display: flex;
+ justify-content: space-between;
+ align-items: end;
+ font-size: 0px;
+}
+
+.hero_p {
+ width: 357px;
+ height: 260px;
+ margin: auto 0;
+}
+
+.hero_p > p {
+ font-size: 4rem;
+ font-weight: 700;
+ line-height: 56px;
+ margin-bottom: 32px;
+}
+
+.hero_p .go_button {
+ height: 56px;
+ line-height: 56px;
+ text-align: center;
+ border-radius: 40px;
+ background-color: #3692ff;
+ color: #f9fafb;
+ font-size: 2rem;
+ font-weight: 600;
+}
+
+.hero_img1 {
+ width: 746px;
+ height: 340px;
+}
diff --git a/src/components/Main/Main.module.css b/src/components/Main/Main.module.css
deleted file mode 100644
index 6edeb266..00000000
--- a/src/components/Main/Main.module.css
+++ /dev/null
@@ -1,79 +0,0 @@
-.main {
- padding: 26px 200px;
- color: #111827;
-}
-
-.container {
- margin: 0 auto;
- width: 1118px;
-}
-
-.bestItem {
-}
-
-.title {
- font-weight: 700;
- font-size: 2rem;
- margin-bottom: 16px;
-}
-
-.onSales {
- margin-top: 40px;
-}
-
-.topBar {
- display: flex;
- justify-content: space-between;
- margin-bottom: 24px;
-}
-
-.toolBox {
- display: flex;
- justify-content: space-between;
- gap: 12px;
-}
-
-.searchBox {
- position: relative;
-}
-
-.search {
- width: 310px;
- height: 42px;
- border-radius: 8px;
- background-color: #f3f4f6;
- border: none;
- font-weight: 400;
- font-size: 1.6rem;
- padding: 0 39px 0 13px;
-}
-
-.searchLogo {
- width: 15px;
- height: 14.5px;
- position: absolute;
- right: 13px;
- top: 45%;
- transform: translateY(-50%);
-}
-
-.regist {
- width: 133px;
- height: 42px;
- line-height: 42px;
- text-align: center;
- font-weight: 600;
- color: #f3f4f6;
- background-color: #3692ff;
- border-radius: 8px;
- font-size: 1.6rem;
- cursor: pointer;
-}
-
-.select {
- width: 130px;
- height: 42px;
- border-radius: 8px;
- padding: 0 20px;
- font-size: 1.6rem;
-}
diff --git a/src/components/Main/PopularProducts.js b/src/components/Main/PopularProducts.js
new file mode 100644
index 00000000..ee590005
--- /dev/null
+++ b/src/components/Main/PopularProducts.js
@@ -0,0 +1,19 @@
+import React from 'react'
+import styles from './PopularProducts.module.css'
+
+function PopularProducts() {
+ return (
+
+
+
+
+
Hot item
+
인기 상품을
확인해 보세요
+
가장 HOT한 중고거래 물품을
판다 마켓에서 확인해 보세요
+
+
+
+ )
+}
+
+export default PopularProducts
\ No newline at end of file
diff --git a/src/components/Main/PopularProducts.module.css b/src/components/Main/PopularProducts.module.css
new file mode 100644
index 00000000..ac9fad30
--- /dev/null
+++ b/src/components/Main/PopularProducts.module.css
@@ -0,0 +1,96 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) and (max-width: 1440px) {
+ section.popular_products {
+ height: calc(540px - 108px);
+ }
+ div.popular_box {
+ transform: scale(0.75);
+ transform-origin: center;
+ }
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+ section.popular_products {
+ height: calc(540px - 216px);
+ }
+ div.popular_box {
+ transform: scale(0.6);
+ transform-origin: center;
+ }
+ div.popular_p {
+ min-width: 275px;
+ }
+ div.popular_p > span {
+ font-size: 2.4rem;
+ }
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+ section.popular_products {
+ height: calc(540px - 100px);
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
+ }
+ div.popular_box {
+ height: 800px;
+ flex-direction: column-reverse;
+ justify-content: space-around;
+ transform: scale(0.5);
+ transform-origin: center;
+ }
+ div.popular_p > span {
+ font-size: 3rem;
+ }
+}
+
+.popular_products {
+ background-color: #ffffff;
+ height: 720px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ position: relative;
+}
+
+.popular_box {
+ width: 988px;
+ padding: 0 31px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ box-sizing: border-box;
+ gap: 0 5%;
+}
+
+.popular_box > img {
+ width: 588px;
+}
+
+.popular_p {
+ width: 275px;
+}
+
+.popular_p > span {
+ display: inline-block;
+ font-size: 1.8rem;
+ color: #3692ff;
+ font-weight: 700;
+ margin-bottom: 12px;
+}
+
+.popular_p > p {
+ font-weight: 700;
+ font-size: 4rem;
+ line-height: 56px;
+ margin-bottom: 24px;
+ color: #374151;
+}
+
+.popular_p > div {
+ width: 287px;
+ font-size: 2.4rem;
+ line-height: 32px;
+ color: #374151;
+ font-weight: 500;
+}
diff --git a/src/components/Main/RegisterProduct.js b/src/components/Main/RegisterProduct.js
new file mode 100644
index 00000000..df35b2d7
--- /dev/null
+++ b/src/components/Main/RegisterProduct.js
@@ -0,0 +1,19 @@
+import React from 'react'
+import styles from './RegisterProduct.module.css'
+
+function RegisterProduct() {
+ return (
+
+
+
+
+
Register
+
판매를 원하는
상품을 등록하세요
+
어떤 물건이든 판매하고 싶은 상품을
쉽게 등록하세요
+
+
+
+ )
+}
+
+export default RegisterProduct
\ No newline at end of file
diff --git a/src/components/Main/RegisterProduct.module.css b/src/components/Main/RegisterProduct.module.css
new file mode 100644
index 00000000..7d39452a
--- /dev/null
+++ b/src/components/Main/RegisterProduct.module.css
@@ -0,0 +1,102 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) and (max-width: 1440px) {
+ section.register-product {
+ height: calc(540px - 108px);
+ }
+ div.register_box {
+ transform: scale(0.75);
+ transform-origin: center;
+ }
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+ section.register_product {
+ height: calc(540px - 40%);
+ }
+ div.register_box {
+ transform: scale(0.6);
+ transform-origin: center;
+ }
+ div.register_p {
+ min-width: 336px;
+ }
+ div.register_p > span {
+ font-size: 2.4rem;
+ }
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+ section.register_product {
+ height: calc(540px - 100px);
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
+ }
+ div.register_box {
+ height: 800px;
+ flex-direction: column-reverse;
+ justify-content: space-around;
+ transform: scale(0.5);
+ transform-origin: center;
+ }
+ div.register_p > span {
+ font-size: 3rem;
+ }
+}
+
+.register_product {
+ background-color: #ffffff;
+ height: 720px;
+ /* border: 1px solid blue; */
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ /* border-bottom: 1px solid red; */
+}
+
+.register_box {
+ width: 988px;
+ /* position: relative;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%); */
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ box-sizing: border-box;
+ /* border: 1px solid red; */
+ gap: 0 5%;
+}
+
+.register_box > img {
+ width: 588px;
+ /* display: inline-block; */
+}
+
+.register_p {
+ width: 336px;
+}
+
+.register_p > span {
+ display: inline-block;
+ font-size: 1.8rem;
+ color: #3692ff;
+ font-weight: 700;
+ margin-bottom: 12px;
+}
+
+.register_p > p {
+ font-weight: 700;
+ font-size: 4rem;
+ line-height: 56px;
+ margin-bottom: 24px;
+ color: #374151;
+}
+
+.register_p > div {
+ width: 353px;
+ font-size: 2.4rem;
+ line-height: 32px;
+ color: #374151;
+ font-weight: 500;
+}
diff --git a/src/components/Main/SearchSection.js b/src/components/Main/SearchSection.js
new file mode 100644
index 00000000..c63fe28b
--- /dev/null
+++ b/src/components/Main/SearchSection.js
@@ -0,0 +1,19 @@
+import React from 'react'
+import styles from './SearchSection.module.css'
+
+function SearchSection() {
+ return (
+
+
+
+
Search
+
구매를 원하는
상품을 검색하세요
+
구매하고 싶은 물품은 검색해서
쉽게 찾아보세요
+
+
+
+
+ )
+}
+
+export default SearchSection
\ No newline at end of file
diff --git a/src/components/Main/SearchSection.module.css b/src/components/Main/SearchSection.module.css
new file mode 100644
index 00000000..adf620fa
--- /dev/null
+++ b/src/components/Main/SearchSection.module.css
@@ -0,0 +1,103 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) and (max-width: 1440px) {
+ section.search-section {
+ height: calc(540px - 108px);
+ }
+ div.search_box {
+ transform: scale(0.75);
+ transform-origin: center;
+ }
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+ section.search_section {
+ height: calc(540px - 40%);
+ }
+ div.search_box {
+ transform: scale(0.6);
+ transform-origin: center;
+ }
+ div.search_p {
+ min-width: 317px;
+ }
+ div.search_p > span {
+ font-size: 2.4rem;
+ }
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+ section.search_section {
+ height: calc(540px - 100px);
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
+ }
+ div.search_box {
+ height: 800px;
+ flex-direction: column;
+ justify-content: space-around;
+ transform: scale(0.5);
+ transform-origin: center;
+ }
+ div.search_p > span {
+ font-size: 3rem;
+ }
+}
+
+.search_section {
+ background-color: #ffffff;
+ height: 720px;
+ /* border: 1px solid blue; */
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ /* border-bottom: 1px solid red; */
+}
+
+.search_box {
+ width: 988px;
+ padding: 0 9.5px;
+ /* position: relative;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%); */
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ box-sizing: border-box;
+ /* border: 1px solid red; */
+ gap: 0 5%;
+}
+
+.search_box > img {
+ width: 588px;
+ /* display: inline-block; */
+}
+
+.search_p {
+ text-align: right;
+ width: 317px;
+}
+
+.search_p > span {
+ display: inline-block;
+ font-size: 1.8rem;
+ color: #3692ff;
+ font-weight: 700;
+ margin-bottom: 12px;
+}
+
+.search_p > p {
+ font-weight: 700;
+ font-size: 4rem;
+ line-height: 56px;
+ margin-bottom: 24px;
+ color: #374151;
+}
+
+.search_p > div {
+ font-size: 2.4rem;
+ line-height: 32px;
+ color: #374151;
+ font-weight: 500;
+}
diff --git a/src/components/Main/WeAreSection.js b/src/components/Main/WeAreSection.js
new file mode 100644
index 00000000..d2098b5e
--- /dev/null
+++ b/src/components/Main/WeAreSection.js
@@ -0,0 +1,15 @@
+import React from 'react'
+import styles from './WeAreSection.module.css'
+
+function WeAreSection() {
+ return (
+
+
+
믿을 수 있는
판다 마켓 중고거래
+
+
+
+ )
+}
+
+export default WeAreSection
\ No newline at end of file
diff --git a/src/components/Main/WeAreSection.module.css b/src/components/Main/WeAreSection.module.css
new file mode 100644
index 00000000..335ff0de
--- /dev/null
+++ b/src/components/Main/WeAreSection.module.css
@@ -0,0 +1,74 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) and (max-width: 1440px) {
+ section.we_are {
+ height: calc(540px - 108px);
+ }
+ div.we_are_box {
+ transform: scale(0.75);
+ transform-origin: center bottom;
+ }
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+ section.we_are {
+ height: calc(540px - 40%);
+ margin-top: 0;
+ }
+ div.we_are_box {
+ transform: scale(0.6);
+ transform-origin: center bottom;
+ }
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+ section.we_are {
+ position: relative;
+ height: calc(540px - 180px);
+ margin-top: 0;
+ }
+ div.we_are_box {
+ height: 600px;
+ width: 400px;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: center;
+ position: absolute;
+ bottom: 0;
+ transform: scale(0.5);
+ transform-origin: center bottom;
+ }
+}
+
+.we_are {
+ margin-top: 138px;
+ background-color: #cfe5ff;
+ height: 540px;
+ display: flex;
+ justify-content: center;
+ align-items: end;
+ position: relative;
+}
+
+.we_are_box {
+ width: 1110px;
+ height: 397px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ font-size: 0px;
+}
+
+.we_are_p {
+ width: 313px;
+ height: 172px;
+ font-size: 4rem;
+ font-weight: 700;
+ line-height: 56px;
+ color: #374151;
+}
+
+.sc5_img5 {
+ width: 746px;
+}
diff --git a/src/components/Nav/Nav.js b/src/components/Nav/Nav.js
index d9ff2c8d..6d0c44cc 100644
--- a/src/components/Nav/Nav.js
+++ b/src/components/Nav/Nav.js
@@ -1,20 +1,35 @@
import React from 'react';
+import { Link, useLocation } from 'react-router-dom';
import styles from './Nav.module.css'
-import logo from '../../assets/images/logo.png'
function Nav() {
+ const location = useLocation();
+
+ const isLoggedIn = false; // true 또는 false로 각각 바꿔보며 확인
+
return (
-
-
-
+ <>
+
+
+
+
판다마켓
+
+
+ {isLoggedIn ? (
+
+
+
+ ) : (
+
로그인
+ )}
-
-
로그인
-
+
+
{/* nav 뒤 채우기 */}
+ >
);
}
diff --git a/src/components/Nav/Nav.module.css b/src/components/Nav/Nav.module.css
index b2c8b06e..98f712e6 100644
--- a/src/components/Nav/Nav.module.css
+++ b/src/components/Nav/Nav.module.css
@@ -1,11 +1,43 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) {
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+}
+
.nav {
- height: 70px;
background: #fff;
+ width: 100%;
+ position: fixed;
+ z-index: 1;
+}
+
+.gnb {
+ height: 70px;
padding: 0 200px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #dfdfdf;
+ /* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+ @media (min-width: 744px) and (max-width: 1199.98px) {
+ margin: 0 auto;
+ /* max-width: 696px; */
+ width: 100%;
+ padding: 0 15px;
+ }
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ margin: 0 auto;
+ /* max-width: 344px; */
+ width: 100%;
+ padding: 0 15px;
+ }
}
.logo {
@@ -19,6 +51,10 @@
width: 40px;
position: relative;
margin-right: 8px;
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ display: none;
+ }
}
.logoTitle {
@@ -28,6 +64,10 @@
font-size: 2.56rem;
color: #3692ff;
display: inline-block;
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ font-size: 2rem;
+ }
}
.ul {
@@ -48,6 +88,16 @@
color: #4b5563;
padding: 0 15px;
cursor: pointer;
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ padding: 0;
+ width: 74px;
+ font-size: 1.6rem;
+ }
+}
+
+.active {
+ color: #3692ff;
}
.li:hover {
@@ -66,4 +116,18 @@
border-radius: 8px;
font-size: 1.6rem;
cursor: pointer;
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ width: 88px;
+ }
+}
+
+.avatar {
+ width: 40px;
+ height: 40px;
+}
+
+.avatar img {
+ width: 40px;
+ object-fit: cover;
}
diff --git a/src/components/Pagination/Pagination_copy.js b/src/components/Pagination/Pagination(page-based).js
similarity index 83%
rename from src/components/Pagination/Pagination_copy.js
rename to src/components/Pagination/Pagination(page-based).js
index 9fdda26c..5e5b8c8a 100644
--- a/src/components/Pagination/Pagination_copy.js
+++ b/src/components/Pagination/Pagination(page-based).js
@@ -8,13 +8,17 @@ const Pagination = ({ currentPage, totalPages, onPageChange }) => {
const handlePreviousGroup = () => {
if (currentGroup > 0) {
+ const newGroup = currentGroup - 1;
setCurrentGroup(currentGroup - 1);
+ onPageChange((newGroup + 1) * pagesPerGroup); // 이전 그룹의 마지막 페이지로 이동
}
};
const handleNextGroup = () => {
if ((currentGroup + 1) * pagesPerGroup < totalPages) {
- setCurrentGroup(currentGroup + 1);
+ const newGroup = currentGroup + 1;
+ setCurrentGroup(newGroup);
+ onPageChange(newGroup * pagesPerGroup + 1); // 다음 그룹의 첫 번째 페이지로 이동
}
};
diff --git a/src/components/Pagination/Pagination.js b/src/components/Pagination/Pagination.js
index 5e5b8c8a..cf05930a 100644
--- a/src/components/Pagination/Pagination.js
+++ b/src/components/Pagination/Pagination.js
@@ -1,16 +1,16 @@
import React, { useState } from 'react';
import styles from './Pagination.module.css';
-const Pagination = ({ currentPage, totalPages, onPageChange }) => {
+const Pagination = ({ currentPage, totalPages, onPageChange, itemsPerPage }) => {
const [currentGroup, setCurrentGroup] = useState(0); // 현재 페이지 그룹
-
const pagesPerGroup = 5; // 한 그룹당 표시할 페이지 수
const handlePreviousGroup = () => {
if (currentGroup > 0) {
const newGroup = currentGroup - 1;
- setCurrentGroup(currentGroup - 1);
- onPageChange((newGroup + 1) * pagesPerGroup); // 이전 그룹의 마지막 페이지로 이동
+ setCurrentGroup(newGroup);
+ const newOffset = (newGroup * pagesPerGroup + pagesPerGroup - 1) * itemsPerPage;
+ onPageChange(newOffset); // 이전 그룹의 마지막 페이지의 offset으로 이동
}
};
@@ -18,17 +18,24 @@ const Pagination = ({ currentPage, totalPages, onPageChange }) => {
if ((currentGroup + 1) * pagesPerGroup < totalPages) {
const newGroup = currentGroup + 1;
setCurrentGroup(newGroup);
- onPageChange(newGroup * pagesPerGroup + 1); // 다음 그룹의 첫 번째 페이지로 이동
+ const newOffset = newGroup * pagesPerGroup * itemsPerPage;
+ onPageChange(newOffset); // 다음 그룹의 첫 번째 페이지의 offset으로 이동
}
};
const handlePageClick = (pageNumber) => {
- onPageChange(pageNumber);
+ console.log(`Current Page: ${currentPage}, Clicked Page: ${pageNumber}, itemsPerPage: ${itemsPerPage}`);
+ if (pageNumber !== currentPage) { // 현재 페이지와 다른 경우에만 실행
+ const newOffset = (pageNumber - 1) * itemsPerPage;
+ console.log(`Page clicked: ${pageNumber}, New offset: ${newOffset}`);
+ onPageChange(newOffset);
+ }
};
+
const renderPageNumbers = () => {
const startPage = currentGroup * pagesPerGroup + 1;
- const endPage = Math.min(startPage + pagesPerGroup - 1, totalPages); // 총 페이지 수에 맞게 마지막 페이지 설정
+ const endPage = Math.min(startPage + pagesPerGroup - 1, totalPages);
const pages = [];
for (let i = startPage; i <= endPage; i++) {
@@ -49,9 +56,13 @@ const Pagination = ({ currentPage, totalPages, onPageChange }) => {
{renderPageNumbers()}
-
+
);
};
-export default Pagination;
\ No newline at end of file
+export default Pagination;
diff --git a/src/components/Pagination/Pagination.module.css b/src/components/Pagination/Pagination.module.css
index a7e505d5..7c32f88d 100644
--- a/src/components/Pagination/Pagination.module.css
+++ b/src/components/Pagination/Pagination.module.css
@@ -1,5 +1,5 @@
.pagination {
- margin-top: ;
+ margin-top: 0;
display: flex;
justify-content: center;
align-items: center;
@@ -18,12 +18,12 @@
color: #6b7280;
background-color: #fff;
cursor: pointer;
- background: url("../../assets/images/page_left_arrow.png") no-repeat center /
+ background: url("/public/static/images/page_left_arrow.png") no-repeat center /
7px 10px;
}
.arrowButton.right {
- background: url("../../assets/images/page_right_arrow.png") no-repeat center /
+ background: url("/public/static/images/page_right_arrow.png") no-repeat center /
7px 10px;
}
diff --git a/src/components/ProductCard/ProductCard.js b/src/components/ProductCard/ProductCard.js
index 8502208f..e5785638 100644
--- a/src/components/ProductCard/ProductCard.js
+++ b/src/components/ProductCard/ProductCard.js
@@ -1,11 +1,17 @@
import React from 'react';
import styles from './ProductCard.module.css';
-import likeIcon from '../../assets/images/like-icon.png';
-import placeholderImage from '../../assets/images/placeholder.png';
+// import placeholderImage from '../../assets/images/placeholder.png';
+
+// const placeholderImage = 'https://picsum.photos/id/8/343';
+const placeholderIds = [0, 2, 6, 8, 9, 20, 26, 30, 36, 39, 48, 60, 145, 157, 160, 180, 201, 225, 250, 312, 366, 370];
+
const ProductCard = ({ product, size }) => {
const formattedPrice = new Intl.NumberFormat('ko-KR').format(product.price);
+ const randomId = placeholderIds[Math.floor(Math.random() * placeholderIds.length)];
+ const placeholderImage = `https://picsum.photos/id/${randomId}/343`;
+
const handleImageError = (e) => {
e.target.src = placeholderImage; // 이미지 로드 실패 시 대체 이미지 설정
};
@@ -17,7 +23,7 @@ const ProductCard = ({ product, size }) => {
{product.name}
{formattedPrice}원
-
+
{product.favoriteCount}
diff --git a/src/components/ProductCard/ProductCard.module.css b/src/components/ProductCard/ProductCard.module.css
index b7bbe8b5..316a8ca6 100644
--- a/src/components/ProductCard/ProductCard.module.css
+++ b/src/components/ProductCard/ProductCard.module.css
@@ -1,22 +1,84 @@
+/* PC 스타일: 1200px 이상 */
+@media (min-width: 1200px) {
+ :root {
+ --card-width: 261px;
+ --card-height: 370px;
+ --card-small-width: 215px;
+ --card-small-height: 311px;
+ }
+}
+
+/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+@media (min-width: 744px) and (max-width: 1199.98px) {
+ :root {
+ --card-width: 343px;
+ --card-height: 434px;
+ --card-small-width: 215px;
+ --card-small-height: 311px;
+ }
+}
+
+/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+@media (min-width: 375px) and (max-width: 743.98px) {
+ :root {
+ --card-width: 343px;
+ --card-height: 434px;
+ --card-small-width: 168px;
+ --card-small-height: 264px;
+ }
+}
+
.card {
- width: 261px;
- height: 370px;
+ width: var(--card-width);
+ height: var(--card-height);
}
.image {
- width: 261px;
- height: 261px;
+ width: var(--card-width);
+ height: var(--card-width);
object-fit: cover;
margin-bottom: 16px;
+ border-radius: 16px;
}
-.details {
+/* ------------------------ */
+
+.card.small {
+ width: var(--card-small-width);
+ height: var(--card-small-height);
+ margin-bottom: 40px;
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ margin-bottom: 32px;
+ }
+}
+
+.card.small > .image {
+ width: var(--card-small-width);
+ height: var(--card-small-width);
+ object-fit: cover;
+ margin-bottom: 14px;
+}
+
+.card.small .price {
+ line-height: 3.7rem;
}
+/* ------------------------ */
+
.name {
font-size: 1.4rem;
line-height: 2.4rem;
font-weight: 500;
+ /* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+ @media (min-width: 744px) and (max-width: 1199.98px) {
+ line-height: 2rem;
+ }
+
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ line-height: 2rem;
+ }
}
.price {
@@ -24,6 +86,15 @@
font-size: 1.6rem;
line-height: 4.1rem;
font-family: Pretendard;
+ /* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+ @media (min-width: 744px) and (max-width: 1199.98px) {
+ line-height: 3.5rem;
+ }
+
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ line-height: 3.5rem;
+ }
}
.likes {
@@ -43,22 +114,3 @@
font-weight: 500;
font-size: 1.2rem;
}
-
-/* ------------------------ */
-
-.card.small {
- width: 215px;
- height: 311px;
- margin-bottom: 40px;
-}
-
-.card.small > .image {
- width: 215px;
- height: 215px;
- object-fit: cover;
- margin-bottom: 14px;
-}
-
-.card.small .price {
- line-height: 3.7rem;
-}
diff --git a/src/components/ProductList/BestProductList.js b/src/components/ProductList/BestProductList.js
index 3ebe4c91..2f9ef0e4 100644
--- a/src/components/ProductList/BestProductList.js
+++ b/src/components/ProductList/BestProductList.js
@@ -1,38 +1,39 @@
import React, { useEffect, useState } from 'react';
import ProductCard from '../ProductCard/ProductCard';
-import { getProductList } from '../../apis/ProductService';
+// import { getProductList } from '../../apis/ProductService';
+import { getProductList } from '../../apis/ProductService(MongoDB)';
import styles from './BestProductList.module.css';
import useMediaQuery from '../../hooks/useMediaQuery';
const BestProductList = () => {
const [products, setProducts] = useState([]);
- // 화면 크기에 따른 열 개수 및 pageSize 설정
+ // 화면 크기에 따른 열 개수 및 limit 설정
const isDesktop = useMediaQuery('(min-width:1200px)');
- const isTablet = useMediaQuery('(min-width:768px) and (max-width:1199px)');
- const isMobile = useMediaQuery('(max-width:767px)');
+ const isTablet = useMediaQuery('(min-width:744px) and (max-width:1199.98px)');
+ const isMobile = useMediaQuery('(max-width:743px)');
const columns = isDesktop ? 4 : isTablet ? 2 : 1;
- const pageSize = columns; // 화면 크기에 맞춰 pageSize를 columns와 동일하게 설정
+ const limit = columns; // limit을 columns와 동일하게 설정
useEffect(() => {
- // API에서 데이터 가져오기 - pageSize를 동적으로 전달
- getProductList(1, pageSize, 'favorite', '')
+ // API에서 데이터 가져오기 - limit을 동적으로 전달
+ getProductList(0, limit, 'favorite', '') // offset = 0으로 설정하여 첫 페이지만 로드
.then(data => {
- setProducts(data.list);
+ setProducts(data.products); // API 응답에서 'products'를 사용
})
.catch(error => {
console.error(error);
});
- }, [pageSize]); // pageSize가 변경될 때마다 호출
+ }, [limit]); // limit이 변경될 때마다 호출
return (
{products.map(product => (
-
+
))}
);
};
-export default BestProductList;
\ No newline at end of file
+export default BestProductList;
diff --git a/src/components/ProductList/BestProductList.module.css b/src/components/ProductList/BestProductList.module.css
index 7e210dc9..51513451 100644
--- a/src/components/ProductList/BestProductList.module.css
+++ b/src/components/ProductList/BestProductList.module.css
@@ -1,5 +1,20 @@
.productList {
+ width: 100%;
display: flex;
flex-wrap: wrap;
- gap: 24px;
+
+ /* PC 스타일: 1200px 이상 */
+ @media (min-width: 1200px) {
+ gap: 24.6px;
+ }
+
+ /* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+ @media (min-width: 744px) and (max-width: 1199.98px) {
+ gap: 10px;
+ }
+
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ gap: 0;
+ }
}
diff --git a/src/components/ProductList/onSalesProductList.js b/src/components/ProductList/onSalesProductList.js
index 0f195c28..4401e2c1 100644
--- a/src/components/ProductList/onSalesProductList.js
+++ b/src/components/ProductList/onSalesProductList.js
@@ -1,45 +1,67 @@
import React, { useEffect, useState } from 'react';
import ProductCard from '../ProductCard/ProductCard';
-import { getProductList } from '../../apis/ProductService';
+// import { getProductList } from '../../apis/ProductService';
+import { getProductList } from '../../apis/ProductService(MongoDB)';
import Pagination from '../Pagination/Pagination';
import styles from './onSalesProductList.module.css';
import useMediaQuery from '../../hooks/useMediaQuery';
-
const OnSalesProductList = ({ orderBy = 'recent', keyword }) => {
const [products, setProducts] = useState([]);
- const [page, setPage] = useState(1);
+ const [offset, setOffset] = useState(0);
const [totalPages, setTotalPages] = useState(1);
- // 화면 크기에 따른 열 개수 및 pageSize 설정
+ // 화면 크기에 따른 열 개수 및 limit 설정
const isDesktop = useMediaQuery('(min-width:1200px)');
- const isTablet = useMediaQuery('(min-width:768px) and (max-width:1199px)');
- const isMobile = useMediaQuery('(max-width:767px)');
+ const isTablet = useMediaQuery('(min-width:744px) and (max-width:1199.98px)');
+ const isMobile = useMediaQuery('(max-width:743px)');
+
+ let columns;
+ if (isDesktop) {
+ columns = 5;
+ } else if (isTablet) {
+ columns = 3;
+ } else if (isMobile) {
+ columns = 2;
+ }
- const columns = isDesktop ? 5 : isTablet ? 3 : 2;
- const pageSize = columns * 2; // 화면 크기에 맞춰 pageSize를 columns와 동일하게 설정
+ const limit = columns * 2; // limit 설정
useEffect(() => {
- getProductList(page, pageSize, orderBy, keyword)
+ console.log(`Fetching products with offset: ${offset} and limit: ${limit}`);
+ getProductList(offset, limit, orderBy, keyword)
.then(data => {
- setProducts(data.list);
- setTotalPages(Math.ceil(data.totalCount / pageSize)); // 총 페이지 수 설정
+ setProducts(data.products); // API 응답이 'products'로 되어 있음
+ setTotalPages(Math.ceil(data.totalCount / limit)); // 총 페이지 수 설정
})
.catch(error => {
console.error(error);
});
- }, [page, pageSize, orderBy, keyword]);
+ }, [offset, limit, orderBy, keyword]);
+
+ // 페이지 변경 함수
+ const handlePageChange = (newOffset) => {
+ if (newOffset !== offset) { // 기존 offset과 다를 때만 업데이트
+ console.log(`Updating offset to ${newOffset}`);
+ setOffset(newOffset);
+ }
+ };
return (
<>
{products.map(product => (
-
+
))}
-
+
>
);
};
-export default OnSalesProductList;
\ No newline at end of file
+export default OnSalesProductList;
diff --git a/src/components/ProductList/onSalesProductList.module.css b/src/components/ProductList/onSalesProductList.module.css
index cb531863..14bb459a 100644
--- a/src/components/ProductList/onSalesProductList.module.css
+++ b/src/components/ProductList/onSalesProductList.module.css
@@ -1,7 +1,22 @@
.productList {
display: flex;
flex-wrap: wrap;
- gap: 10px;
+ /* justify-content: space-between; */
+
+ /* PC 스타일: 1200px 이상 */
+ @media (min-width: 1200px) {
+ gap: 10.75px;
+ }
+
+ /* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
+ @media (min-width: 744px) and (max-width: 1199.98px) {
+ gap: 25.5px;
+ }
+
+ /* Mobile 스타일: 375px 이상 ~ 743px 이하 */
+ @media (min-width: 375px) and (max-width: 743.98px) {
+ gap: 8px;
+ }
}
/* .productList > div {
diff --git a/src/media_query.css b/src/media_query.css
deleted file mode 100644
index 09e379ff..00000000
--- a/src/media_query.css
+++ /dev/null
@@ -1,21 +0,0 @@
-/* 스프린트 미션4 까지 사용했던 미디어 쿼리 기준
-미션5에 미디어 쿼리 적용을 아직완성하지 못하고 파일만 만들어 둠 */
-
-/* PC 스타일: 1200px 이상 */
-@media (min-width: 1200px) and (max-width: 1440px) {
-}
-
-/* Tablet 스타일: 744px 이상 ~ 1199px 이하 */
-@media (min-width: 744px) and (max-width: 1199px) {
-}
-
-/* Mobile 스타일: 375px 이상 ~ 743px 이하 */
-@media (min-width: 375px) and (max-width: 743px) {
-}
-
-@media (max-width: 500px) {
-}
-
-/* 375px 미만에 대한 스타일은 고려하지 않음 */
-@media (max-width: 374px) {
-}
diff --git a/src/pages/Community.js b/src/pages/Community.js
new file mode 100644
index 00000000..71befc02
--- /dev/null
+++ b/src/pages/Community.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+function Community() {
+ return (
+ Community
+ )
+}
+
+export default Community
\ No newline at end of file
diff --git a/src/pages/Faq.js b/src/pages/Faq.js
new file mode 100644
index 00000000..96135a83
--- /dev/null
+++ b/src/pages/Faq.js
@@ -0,0 +1,9 @@
+import React from 'react'
+
+function Faq() {
+ return (
+ Faq
+ )
+}
+
+export default Faq
\ No newline at end of file
diff --git a/src/components/Main/Main.js b/src/pages/Items.js
similarity index 69%
rename from src/components/Main/Main.js
rename to src/pages/Items.js
index 9306a98d..25b20a3e 100644
--- a/src/components/Main/Main.js
+++ b/src/pages/Items.js
@@ -1,18 +1,24 @@
import React, { useState } from 'react';
-import styles from './Main.module.css'
-import BestProductList from './../ProductList/BestProductList';
-import OnSalesProductList from './../ProductList/onSalesProductList';
-import searchLogo from '../../assets/images/search.png'
+import { Link } from 'react-router-dom';
+import styles from './Items.module.css'
+// import BestProductList from '../components/ProductList/BestProductList';
+import OnSalesProductList from '../components/ProductList/onSalesProductList';
-function Main() {
+function Items() {
const [searchKeyword, setSearchKeyword] = useState('');
const [orderBy, setOrderBy] = useState('recent');
const [finalKeyword, setFinalKeyword] = useState('');
const handleSearchChange = (e) => {
setSearchKeyword(e.target.value);
+ // 검색어가 비어 있을 경우 전체 목록을 보여줌.
+ if (e.target.value === '') {
+ setFinalKeyword(''); // 전체 목록 렌더링
+ }
};
+
+
const handleOrderChange = (e) => {
setOrderBy(e.target.value);
};
@@ -31,12 +37,12 @@ function Main() {
return (
-
*/}
판매 중인 상품
@@ -44,11 +50,11 @@ function Main() {
-
상품 등록하기
+
상품 등록하기
-
+