From e7fdd6288244b63a66cdf366ade388a6ce32cb97 Mon Sep 17 00:00:00 2001 From: Jeongmin Oh Date: Wed, 3 Jul 2024 23:13:54 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat(ProductListItem):=20=EA=B0=81=20?= =?UTF-8?q?=EC=83=81=ED=92=88=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EC=83=81?= =?UTF-8?q?=ED=92=88=EC=9D=98=20=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Main.js | 2 ++ src/components/additem/FileInput.js | 1 - src/components/api.js | 2 +- src/components/items/BestProductList.js | 2 +- src/components/items/ProductListItem.css | 4 ++++ src/components/items/ProductListItem.js | 22 +++++++++++++--------- src/pages/ProductDetailPage.jsx | 5 +++++ 7 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 src/pages/ProductDetailPage.jsx diff --git a/src/Main.js b/src/Main.js index c55e172eb..7b47d5218 100644 --- a/src/Main.js +++ b/src/Main.js @@ -3,6 +3,7 @@ import { BrowserRouter, Routes, Route } from "react-router-dom"; import App from "./App"; import ItemsPage from "./pages/ItemsPage"; import AddItemPage from "./pages/AddItemPage"; +import ProductDetailPage from "./pages/ProductDetailPage"; function Main() { return ( @@ -13,6 +14,7 @@ function Main() { } /> } /> + } /> diff --git a/src/components/additem/FileInput.js b/src/components/additem/FileInput.js index 590c48239..290b9d1b8 100644 --- a/src/components/additem/FileInput.js +++ b/src/components/additem/FileInput.js @@ -42,7 +42,6 @@ function FileInput({ name, onChange }) { 업로드한 이미지 미리보기 ({ id: products.id, - title: products.name, + name: products.name, description: products.description, price: products.price, image: products.images, diff --git a/src/components/items/BestProductList.js b/src/components/items/BestProductList.js index 21b3d36b6..c9e61f1f6 100644 --- a/src/components/items/BestProductList.js +++ b/src/components/items/BestProductList.js @@ -2,7 +2,7 @@ import "./BestProductList.css"; import ProductListItem from "./ProductListItem"; function BestProductList({ products }) { - const sortedProducts = products.sort( + const sortedProducts = [...products].sort( (a, b) => b["favoriteCount"] - a["favoriteCount"] ); const showedProducts = sortedProducts.slice(0, 4); diff --git a/src/components/items/ProductListItem.css b/src/components/items/ProductListItem.css index 2ae86b489..47baed7ed 100644 --- a/src/components/items/ProductListItem.css +++ b/src/components/items/ProductListItem.css @@ -1,3 +1,7 @@ +.product-detail-link { + text-decoration: none; +} + .image { display: block; margin-bottom: 16px; diff --git a/src/components/items/ProductListItem.js b/src/components/items/ProductListItem.js index 8a3ed099a..9a4050273 100644 --- a/src/components/items/ProductListItem.js +++ b/src/components/items/ProductListItem.js @@ -1,20 +1,24 @@ +import { Link } from "react-router-dom"; + import "./ProductListItem.css"; import likeIcon from "../../assets/images/ic_heart_empty.png"; function ProductListItem({ item, className }) { - const { title, price, image, favoriteCount } = item; + const { id, name, price, image, favoriteCount } = item; const classNames = `image ${className}`; return ( -
- {title} -
{title}
-
{price}원
-
- 좋아요 아이콘 -
{favoriteCount}
+ +
+ {name} +
{name}
+
{price}원
+
+ 좋아요 아이콘 +
{favoriteCount}
+
-
+ ); } diff --git a/src/pages/ProductDetailPage.jsx b/src/pages/ProductDetailPage.jsx new file mode 100644 index 000000000..e42a92ba4 --- /dev/null +++ b/src/pages/ProductDetailPage.jsx @@ -0,0 +1,5 @@ +function ProductDetailPage() { + return
; +} + +export default ProductDetailPage; From f6df0ae56db962adb792920a6e703acb92b1a564 Mon Sep 17 00:00:00 2001 From: Jeongmin Oh Date: Fri, 5 Jul 2024 11:53:44 +0900 Subject: [PATCH 2/8] =?UTF-8?q?feat(ProductDetailPage):=20=EC=83=81?= =?UTF-8?q?=ED=92=88=20=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=86=8C=EA=B0=9C=EA=B8=80=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/ic_back.png | Bin 0 -> 706 bytes src/assets/images/ic_heart_empty.png | Bin 459 -> 2280 bytes src/assets/images/ic_heart_full.png | Bin 335 -> 1391 bytes src/assets/images/ic_kebab.png | Bin 0 -> 188 bytes src/assets/images/img_default.png | Bin 0 -> 10360 bytes src/components/ProductDetail/Comment.jsx | 0 src/components/ProductDetail/CommentList.jsx | 0 .../ProductDetail/ProductDetailContent.css | 80 ++++++++++++++++ .../ProductDetail/ProductDetailContent.jsx | 86 ++++++++++++++++++ src/components/ProductDetail/Tag.css | 13 +++ src/components/ProductDetail/Tag.jsx | 7 ++ src/components/api.js | 12 ++- src/components/items/ProductListItem.css | 10 +- src/components/items/ProductListItem.js | 36 ++++++-- src/pages/ItemsPage.js | 2 +- src/pages/ProductDetailPage.css | 31 +++++++ src/pages/ProductDetailPage.jsx | 40 +++++++- 17 files changed, 298 insertions(+), 19 deletions(-) create mode 100644 src/assets/images/ic_back.png create mode 100644 src/assets/images/ic_kebab.png create mode 100644 src/assets/images/img_default.png create mode 100644 src/components/ProductDetail/Comment.jsx create mode 100644 src/components/ProductDetail/CommentList.jsx create mode 100644 src/components/ProductDetail/ProductDetailContent.css create mode 100644 src/components/ProductDetail/ProductDetailContent.jsx create mode 100644 src/components/ProductDetail/Tag.css create mode 100644 src/components/ProductDetail/Tag.jsx create mode 100644 src/pages/ProductDetailPage.css diff --git a/src/assets/images/ic_back.png b/src/assets/images/ic_back.png new file mode 100644 index 0000000000000000000000000000000000000000..55a926b79ffe77eacb959c3939845ddf44800c81 GIT binary patch literal 706 zcmV;z0zLhSP)Ng`+_myE&+s zDJR{EhRQ}_)m7HXl0;A7IhC0ZKr6pA+(xO%rGg4`DH570&4+QqImJO1=%E7@Lk`X-#Up8pUhF|xCi&*}xy zN|No!H<|aFH}!&;Tau!1`BLnXOeFOJNOAy@9DpPTAnA~wdO_@xOsngIjc)9cW`?rQ zdO@_3*nS>=uo4d@iNhb6+RnCj6q<5lnMtfE5Q9A`smS>wq@=Y)(wstIkP}oA>vL`s z`Pqkn206hbvF>KM<$0ELE*#_pk#t0mD)0Y9vW1+pOXB8tZi@%$buvjHCd3< o1nVPIqyz&100000008jDFNj`kbgL~^F8}}l07*qoM6N<$f*i*+n*aa+ literal 0 HcmV?d00001 diff --git a/src/assets/images/ic_heart_empty.png b/src/assets/images/ic_heart_empty.png index 0d2e8e4c2cebfb2cdd011020233735cf1213bcf2..30b0c80f44040f614021b01cebc118d6da3499e2 100644 GIT binary patch delta 2275 zcmV<92pspz1LzSpiBL{Q4GJ0x0000DNk~Le0001B0001B2nGNE0OFW;H~;_u32;bR za{vG#H~;`4H~~eLF<_B4AAbmaNkln({6hQx;Y!5{;QJF5HONW^Rh@r4t z1uCE;6}SW2GsrfXA(c;EW&*ZIu!qiamsHqQNX2<3gEfYkK$k9;E~N;QnG8m^`Tu+( zwzPY@ciNLr*1iVN>P~zA@BaP&-`@qmVzF2(7K_DVu~;k?i^Vc5Fn{PH71u4k{Rc|W zf^i3+#2ol22%zXV(BuKU#@@Uf`4GIC>oy?+=I*#*;*?=3Tc`*n`K| zhjB1VPXj`PF$K_6-+Kcq_|P{XBXAVDYs*X3xbK7mAVA^wKI-M5X&N1cX%n--hytRA zUdO+d5?n?LT$8czPvE+vl|g;=zB?^ynp-I20MYeDTF}NOkCxH?| zv-1{y1Nq2r;=?`|37{tW?KYK)TYOgl8c`9_b2T~`XjvHZ)iE>^Ypc$G}U8^=hfpGLU zdwh!!)0o;L8T|XA((JcpXx@Q1VL=UnQf0+ug7GHto5bs*zL5c4c zVqY}rctNGEPdH>=t}$qw0I^K)B~)xcmN*#~-c+2K9BPuj>}iuq0Ty$lQa}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oM6N<$g3X10hX4Qo diff --git a/src/assets/images/ic_kebab.png b/src/assets/images/ic_kebab.png new file mode 100644 index 0000000000000000000000000000000000000000..b390f973f5e094a02a3d874acb45d424de1c4966 GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D-1!HlL zyA#8@b22Z19F}xPUq=Rpjs4tz5?O)#Ku;IPkP61P7kBeADDp4|+|ND15W>U6<8+ci z=R`Qq1QU@5*DpM<2x8cEZ~4zTMIYB*GjKW>DXcnEo~!srm3yPfVr_;;dP2GN>~cRD dZHz85%1+WS{j~aw?H-`v44$rjF6*2Ung9%@H_`wA literal 0 HcmV?d00001 diff --git a/src/assets/images/img_default.png b/src/assets/images/img_default.png new file mode 100644 index 0000000000000000000000000000000000000000..463f0aaa2a1c52d121e064db47e2fb6feaebb02a GIT binary patch literal 10360 zcmeHsXIN9&xA#c^1yNcQ6a)km5D17yM5GA_DpgTx0A&z@v;+`B59&}woIwF0lo=J2 zs!|ea5P}RcN*C!RgOm(yC;fs2d-Q;x(-2H7VwXE4|pPzM-2d)@hyg@|F4JQUk^u5D%Cb1qQqzvusG>1J#CDJ9d6@Po{ z_R|f-am1hV*#Y~F-+MP7M4zSF)fI*nu70lq3>Whv5fC(%_7DX@`UaX{eEi?xzjpXH z2>wlm|D8zSY6p>O);TP_PeBxAbIjrWpJ+R)$;b{Kc?$?{^5R+mE#~}THU>E@V5<#L zU!)IUdf$FnxX|zlz}iqJ?%NRiFoqqmm--ZsBwa{gPqV^a#qWv8F@}c66ZS&E8q?fv4_SS6 zcagA#?meiwwO0^QB82N+pQJDkn3GA5MJynzpRP@|Ulu3EpgOL>GF{)C3w;oy@)lxy zmqdcM8GgNqj(oB57WyW9K&;E3Q3{>hfzQDX2|cyP8kPKW+u*I;u`@lbK#n#n0+D;V zVnk%hM(6K0d0!nTie&dzn*l-Y+$H~cwB1>91lpDB&Rwj~xQ0$H6Xx)`l1Er$7U84-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;?5peSW9Rr7i z|MoCvE3`MU9)IH;KUv=ro!NAM4 z9Xo4-50)(;X`#NZD9*AeT$3-h?BDx<5u&ifjjyuCJRdP+v8@Fq4^Cx8Zhq$1YdB$q z3Uu_V7||BXO#%0p>x|_5_x-;7kYD1Y7NIb}`y@~G6-~sQDu=ZE{7Lnf5PP1j8QWj} zyL$>UFcXj57C}^Ci{MYekdx>KOs2)-4{o2h0lL%*rR1-=JA$uJAtQRyhO_JauaG#3 zUG^FA18qcYtw{bw@Y${d@_q4#Lr{(H&dBU)*sG{?MSC{n7Ji;57ZHBFrGj0@gO{>3 zg&@*HJQ9K~1JwC<_^%!Q4T67@;eR0#(034XZxZSX>KvbfY6o4pWMNcdaO?j6144MK A8vp { + e.target.src = errorImage; +}; + +function ProductDetailContent({ product }) { + const { + id, + name, + description, + price, + images, + favoriteCount, + tags = [], + } = product; + + const [isButtonClicked, setIsButtonClicked] = useState(false); + const handleButtonClick = () => { + setIsButtonClicked(!isButtonClicked); + }; + + return ( +
+ {name} +
+
+
+
{name}
+ 케밥 메뉴 아이콘 +
+
{price}원
+ +
+
상품 소개
+
{description}
+
상품 태그
+
    + {tags.length > 0 && + tags.map((tag) => { + return ( +
  • + +
  • + ); + })} +
+
+
+ + +
+
+ ); +} + +export default ProductDetailContent; diff --git a/src/components/ProductDetail/Tag.css b/src/components/ProductDetail/Tag.css new file mode 100644 index 000000000..8b9d1b133 --- /dev/null +++ b/src/components/ProductDetail/Tag.css @@ -0,0 +1,13 @@ +.product-tag { + margin-right: 8px; + padding: 6px 16px; + height: 36px; + float: left; + border-radius: 26px; + background-color: var(--gray100); + font-size: 16px; + font-weight: normal; + text-align: center; + line-height: 24px; + color: var(--gray800); +} diff --git a/src/components/ProductDetail/Tag.jsx b/src/components/ProductDetail/Tag.jsx new file mode 100644 index 000000000..0eaff8bf1 --- /dev/null +++ b/src/components/ProductDetail/Tag.jsx @@ -0,0 +1,7 @@ +import "./Tag.css"; + +function Tag({ tag }) { + return
#{tag}
; +} + +export default Tag; diff --git a/src/components/api.js b/src/components/api.js index f4392dc9b..6d37531d4 100644 --- a/src/components/api.js +++ b/src/components/api.js @@ -1,6 +1,6 @@ const BASE_URL = "https://panda-market-api.vercel.app"; -async function fetchProductData() { +export async function fetchProductData() { const url = `${BASE_URL}/products`; const response = await fetch(url); @@ -20,4 +20,12 @@ async function fetchProductData() { return data; } -export default fetchProductData; +export async function fetchProductDataWithId(productId) { + const url = `${BASE_URL}/products/${productId}`; + const response = await fetch(url); + + if (!response || !response.ok) return []; + const result = await response.json(); + + return result; +} diff --git a/src/components/items/ProductListItem.css b/src/components/items/ProductListItem.css index 47baed7ed..e1901dc70 100644 --- a/src/components/items/ProductListItem.css +++ b/src/components/items/ProductListItem.css @@ -2,7 +2,7 @@ text-decoration: none; } -.image { +.product-list-item .image { display: block; margin-bottom: 16px; object-fit: cover; @@ -19,28 +19,28 @@ height: 221px; } -.title { +.product-list-item .title { margin-bottom: 6px; font-weight: 500; font-size: 14px; color: var(--gray800); } -.price { +.product-list-item .price { margin-bottom: 6px; font-weight: bold; font-size: 16px; color: var(--gray800); } -.like { +.product-list-item .like { display: flex; justify-content: flex-start; align-items: center; gap: 4px; } -.like-num { +.product-list-item .like-num { font-weight: 500; font-size: 12px; color: var(--gray600); diff --git a/src/components/items/ProductListItem.js b/src/components/items/ProductListItem.js index 9a4050273..626ab5933 100644 --- a/src/components/items/ProductListItem.js +++ b/src/components/items/ProductListItem.js @@ -2,23 +2,39 @@ import { Link } from "react-router-dom"; import "./ProductListItem.css"; import likeIcon from "../../assets/images/ic_heart_empty.png"; +import errorImage from "../../assets/images/img_default.png"; + +const onErrorImg = (e) => { + e.target.src = errorImage; +}; function ProductListItem({ item, className }) { const { id, name, price, image, favoriteCount } = item; const classNames = `image ${className}`; return ( - -
- {name} -
{name}
-
{price}원
-
- 좋아요 아이콘 -
{favoriteCount}
-
+
+ + {name} + +
{name}
+
{price}원
+
+ 좋아요 아이콘 +
{favoriteCount}
- +
); } diff --git a/src/pages/ItemsPage.js b/src/pages/ItemsPage.js index 2a1da7e86..9f3b38eae 100644 --- a/src/pages/ItemsPage.js +++ b/src/pages/ItemsPage.js @@ -1,7 +1,7 @@ import { useState, useEffect } from "react"; import "./ItemsPage.css"; -import fetchProductData from "../components/api"; +import { fetchProductData } from "../components/api"; import BestProductList from "../components/items/BestProductList"; import AllProductList from "../components/items/AllProductList"; diff --git a/src/pages/ProductDetailPage.css b/src/pages/ProductDetailPage.css new file mode 100644 index 000000000..b27c012a0 --- /dev/null +++ b/src/pages/ProductDetailPage.css @@ -0,0 +1,31 @@ +.product-detail { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 1200px; + margin: 70px auto 0; + padding-top: 24px; +} + +.backto-list-button { + display: flex; + justify-content: center; + align-items: center; + width: 240px; + height: 48px; + padding: 12px; + border: none; + border-radius: 40px; + background-color: var(--blue); + font-size: 18px; + font-weight: 600; + text-decoration: none; + line-height: 24px; + color: var(--white); + cursor: pointer; +} + +.backto-list-button-img { + margin-left: 10px; +} diff --git a/src/pages/ProductDetailPage.jsx b/src/pages/ProductDetailPage.jsx index e42a92ba4..f12ea2886 100644 --- a/src/pages/ProductDetailPage.jsx +++ b/src/pages/ProductDetailPage.jsx @@ -1,5 +1,43 @@ +import { useParams, Link } from "react-router-dom"; +import { useState, useEffect } from "react"; +import { fetchProductDataWithId } from "../components/api"; + +import "./ProductDetailPage.css"; +import goBackIcon from "../assets/images/ic_back.png"; + +import ProductDetailContent from "../components/ProductDetail/ProductDetailContent"; +import CommentList from "../components/ProductDetail/CommentList"; + function ProductDetailPage() { - return
; + const [productDetails, setProductDetails] = useState([]); + + const { productId } = useParams(); + + useEffect(() => { + async function getProductDetail() { + const data = await fetchProductDataWithId(productId); + setProductDetails(data); + } + + getProductDetail(); + }, []); + + return ( +
+ + {/* */} + + 목록으로 돌아가기 + 되돌아가기 아이콘 + +
+ ); } export default ProductDetailPage; From 1dc576fb80d543bfc0155e9201701f59ea7a15b2 Mon Sep 17 00:00:00 2001 From: Jeongmin Oh Date: Fri, 5 Jul 2024 16:43:02 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat(CommentList):=20=EB=AC=B8=EC=9D=98?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20textarea=20=EB=B0=8F=20=EB=93=B1=EB=A1=9D?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Nav.css | 2 +- src/components/ProductDetail/CommentList.css | 48 +++++++++++++++++++ src/components/ProductDetail/CommentList.jsx | 37 ++++++++++++++ .../ProductDetail/ProductDetailContent.css | 1 + src/pages/ProductDetailPage.css | 1 + src/pages/ProductDetailPage.jsx | 2 +- 6 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 src/components/ProductDetail/CommentList.css diff --git a/src/components/Nav.css b/src/components/Nav.css index 16a0f7313..a75ef0a92 100644 --- a/src/components/Nav.css +++ b/src/components/Nav.css @@ -59,7 +59,7 @@ nav { cursor: pointer; } -.active { +.menu.active { color: var(--blue); } diff --git a/src/components/ProductDetail/CommentList.css b/src/components/ProductDetail/CommentList.css new file mode 100644 index 000000000..e7ccff84d --- /dev/null +++ b/src/components/ProductDetail/CommentList.css @@ -0,0 +1,48 @@ +.ask-wrapper { + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: flex-end; + margin-bottom: 24px; + width: 100%; +} + +.ask-label { + width: 100%; + font-size: 16px; + font-weight: normal; + color: var(--gray900); +} + +.ask-content { + width: 100%; + height: 104px; + margin-top: 16px; + margin-bottom: 16px; + padding: 16px 24px; + border: none; + border-radius: 12px; + background-color: var(--gray100); +} +.ask-content::placeholder { + font-size: 16px; + font-weight: normal; + color: var(--gray400); +} + +.add-ask-button { + width: 74px; + height: 42px; + padding: auto 23px; + border: none; + border-radius: 8px; + background-color: var(--gray400); + font-size: 16px; + font-weight: 600; + color: var(--white); +} + +.add-ask-button.active { + background-color: var(--blue); + cursor: pointer; +} diff --git a/src/components/ProductDetail/CommentList.jsx b/src/components/ProductDetail/CommentList.jsx index e69de29bb..721e80ed6 100644 --- a/src/components/ProductDetail/CommentList.jsx +++ b/src/components/ProductDetail/CommentList.jsx @@ -0,0 +1,37 @@ +import { useMemo, useState } from "react"; +import "./CommentList.css"; + +function CommentList() { + const placeholder = + "개인정보를 공유 및 요청하거나 명예 훼손, 무단 광고, 불법 정보 유포 시 모니터링 후 삭제될 수 있으며, " + + "이에 대한 민형사상 책임은 게시자에게 있습니다."; + + const [isInputFill, setIsInputFill] = useState(false); + + const handleValueChange = (e) => { + setIsInputFill(e.target.value !== ""); + }; + + const buttonClassName = isInputFill + ? "add-ask-button active" + : "add-ask-button"; + + return ( +
+ + + +
+ ); +} + +export default CommentList; diff --git a/src/components/ProductDetail/ProductDetailContent.css b/src/components/ProductDetail/ProductDetailContent.css index 581149899..9dd17be78 100644 --- a/src/components/ProductDetail/ProductDetailContent.css +++ b/src/components/ProductDetail/ProductDetailContent.css @@ -1,6 +1,7 @@ .contents-wrapper { display: flex; justify-content: space-between; + margin-bottom: 24px; padding-bottom: 32px; width: 100%; border-bottom: solid 1px var(--gray200); diff --git a/src/pages/ProductDetailPage.css b/src/pages/ProductDetailPage.css index b27c012a0..829eba6e6 100644 --- a/src/pages/ProductDetailPage.css +++ b/src/pages/ProductDetailPage.css @@ -14,6 +14,7 @@ align-items: center; width: 240px; height: 48px; + margin-bottom: 24px; padding: 12px; border: none; border-radius: 40px; diff --git a/src/pages/ProductDetailPage.jsx b/src/pages/ProductDetailPage.jsx index f12ea2886..e1f8116c9 100644 --- a/src/pages/ProductDetailPage.jsx +++ b/src/pages/ProductDetailPage.jsx @@ -25,7 +25,7 @@ function ProductDetailPage() { return (
- {/* */} + 목록으로 돌아가기 Date: Fri, 5 Jul 2024 22:01:15 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat(ProductDetailPage):=20=EC=BD=94?= =?UTF-8?q?=EB=A9=98=ED=8A=B8=20=EB=AA=A9=EB=A1=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ProductDetail/Comment.css | 29 ++++++++++++++++++ src/components/ProductDetail/Comment.jsx | 31 ++++++++++++++++++++ src/components/ProductDetail/CommentList.css | 5 ++++ src/components/ProductDetail/CommentList.jsx | 24 +++++++++++---- src/pages/ItemsPage.js | 2 +- src/pages/ProductDetailPage.jsx | 14 ++++++--- src/{components => utils}/api.js | 14 ++++++++- 7 files changed, 107 insertions(+), 12 deletions(-) create mode 100644 src/components/ProductDetail/Comment.css rename src/{components => utils}/api.js (68%) diff --git a/src/components/ProductDetail/Comment.css b/src/components/ProductDetail/Comment.css new file mode 100644 index 000000000..03bdbaf72 --- /dev/null +++ b/src/components/ProductDetail/Comment.css @@ -0,0 +1,29 @@ +.comment-wrapper { + margin-bottom: 24px; + border-bottom: solid 1px var(--gray200); +} + +.comment-content { + margin-bottom: 24px; + font-size: 16px; + font-weight: normal; + line-height: 140%; + color: var(--gray800); +} + +.comment-wrapper .writer { + display: flex; + justify-content: flex-start; + align-items: flex-start; + margin-bottom: 24px; +} + +.writer .image { + margin-right: 8px; +} + +.comment-wrapper .nickname { + font-size: 14px; + font-weight: normal; + color: var(--gray600); +} diff --git a/src/components/ProductDetail/Comment.jsx b/src/components/ProductDetail/Comment.jsx index e69de29bb..469b0b69f 100644 --- a/src/components/ProductDetail/Comment.jsx +++ b/src/components/ProductDetail/Comment.jsx @@ -0,0 +1,31 @@ +import "./Comment.css"; + +function Comment({ comment }) { + const { + writer: { image, nickname }, + content, + updateAt, + } = comment; + + const updateDate = new Date(updateAt); + const updatedTime = new Date(updateAt) - new Date(); + + return ( +
+
{content}
+
+ {nickname} +
{nickname}
+
{updateAt}
+
+
+ ); +} + +export default Comment; diff --git a/src/components/ProductDetail/CommentList.css b/src/components/ProductDetail/CommentList.css index e7ccff84d..f6020a340 100644 --- a/src/components/ProductDetail/CommentList.css +++ b/src/components/ProductDetail/CommentList.css @@ -46,3 +46,8 @@ background-color: var(--blue); cursor: pointer; } + +.comment-lists { + width: 100%; + list-style: none; +} diff --git a/src/components/ProductDetail/CommentList.jsx b/src/components/ProductDetail/CommentList.jsx index 721e80ed6..82c7940ef 100644 --- a/src/components/ProductDetail/CommentList.jsx +++ b/src/components/ProductDetail/CommentList.jsx @@ -1,11 +1,9 @@ -import { useMemo, useState } from "react"; -import "./CommentList.css"; +import { useState } from "react"; -function CommentList() { - const placeholder = - "개인정보를 공유 및 요청하거나 명예 훼손, 무단 광고, 불법 정보 유포 시 모니터링 후 삭제될 수 있으며, " + - "이에 대한 민형사상 책임은 게시자에게 있습니다."; +import "./CommentList.css"; +import Comment from "./Comment"; +function CommentList({ comments }) { const [isInputFill, setIsInputFill] = useState(false); const handleValueChange = (e) => { @@ -16,6 +14,10 @@ function CommentList() { ? "add-ask-button active" : "add-ask-button"; + const placeholder = + "개인정보를 공유 및 요청하거나 명예 훼손, 무단 광고, 불법 정보 유포 시 모니터링 후 삭제될 수 있으며, " + + "이에 대한 민형사상 책임은 게시자에게 있습니다."; + return (
); } diff --git a/src/pages/ItemsPage.js b/src/pages/ItemsPage.js index 9f3b38eae..cdf733ce6 100644 --- a/src/pages/ItemsPage.js +++ b/src/pages/ItemsPage.js @@ -1,7 +1,7 @@ import { useState, useEffect } from "react"; import "./ItemsPage.css"; -import { fetchProductData } from "../components/api"; +import { fetchProductData } from "../utils/api"; import BestProductList from "../components/items/BestProductList"; import AllProductList from "../components/items/AllProductList"; diff --git a/src/pages/ProductDetailPage.jsx b/src/pages/ProductDetailPage.jsx index e1f8116c9..90f0daed5 100644 --- a/src/pages/ProductDetailPage.jsx +++ b/src/pages/ProductDetailPage.jsx @@ -1,6 +1,6 @@ import { useParams, Link } from "react-router-dom"; import { useState, useEffect } from "react"; -import { fetchProductDataWithId } from "../components/api"; +import { fetchProductDataById, fetchProductComment } from "../utils/api"; import "./ProductDetailPage.css"; import goBackIcon from "../assets/images/ic_back.png"; @@ -10,22 +10,28 @@ import CommentList from "../components/ProductDetail/CommentList"; function ProductDetailPage() { const [productDetails, setProductDetails] = useState([]); + const [productComments, setProductComments] = useState([]); const { productId } = useParams(); useEffect(() => { async function getProductDetail() { - const data = await fetchProductDataWithId(productId); + const data = await fetchProductDataById(productId); setProductDetails(data); } - getProductDetail(); + + async function getProductComment() { + const data = await fetchProductComment(productId); + setProductComments(data); + } + getProductComment(); }, []); return (
- + 목록으로 돌아가기 Date: Fri, 5 Jul 2024 22:49:28 +0900 Subject: [PATCH 5/8] =?UTF-8?q?feat(Comment):=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=EA=B0=80=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20?= =?UTF-8?q?=EB=90=9C=20=EC=8B=9C=EC=A0=90=EC=9C=BC=EB=A1=9C=EB=B6=80?= =?UTF-8?q?=ED=84=B0=20=EA=B2=BD=EA=B3=BC=ED=95=9C=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=EC=9D=84=20=EA=B3=84=EC=82=B0=ED=95=98=EB=8A=94=20util=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ProductDetail/Comment.css | 20 +++++++++++++++--- src/components/ProductDetail/Comment.jsx | 15 ++++++++------ src/utils/getTimeElapsed.js | 26 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 src/utils/getTimeElapsed.js diff --git a/src/components/ProductDetail/Comment.css b/src/components/ProductDetail/Comment.css index 03bdbaf72..ec67daf37 100644 --- a/src/components/ProductDetail/Comment.css +++ b/src/components/ProductDetail/Comment.css @@ -11,19 +11,33 @@ color: var(--gray800); } -.comment-wrapper .writer { +.writer-wrapper { display: flex; justify-content: flex-start; align-items: flex-start; margin-bottom: 24px; } -.writer .image { +.writer.image { margin-right: 8px; } -.comment-wrapper .nickname { +.comment-info { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; +} + +.comment-info .nickname { + margin-bottom: 4px; font-size: 14px; font-weight: normal; color: var(--gray600); } + +.comment-info .time-elapsed { + font-size: 12px; + font-weight: normal; + color: var(--gray400); +} diff --git a/src/components/ProductDetail/Comment.jsx b/src/components/ProductDetail/Comment.jsx index 469b0b69f..31a29d41c 100644 --- a/src/components/ProductDetail/Comment.jsx +++ b/src/components/ProductDetail/Comment.jsx @@ -1,19 +1,20 @@ import "./Comment.css"; +import getTimeElapsed from "../../utils/getTimeElapsed"; + function Comment({ comment }) { const { writer: { image, nickname }, content, - updateAt, + updatedAt, } = comment; - const updateDate = new Date(updateAt); - const updatedTime = new Date(updateAt) - new Date(); + const timeElapsed = getTimeElapsed(new Date(updatedAt)); return (
{content}
-
+
-
{nickname}
-
{updateAt}
+
+
{nickname}
+
{timeElapsed}
+
); diff --git a/src/utils/getTimeElapsed.js b/src/utils/getTimeElapsed.js new file mode 100644 index 000000000..7c4975705 --- /dev/null +++ b/src/utils/getTimeElapsed.js @@ -0,0 +1,26 @@ +const getTimeElapsed = (updatedTime) => { + const milliSeconds = new Date() - updatedTime; + + const seconds = milliSeconds / 1000; + if (seconds < 60) return `방금 전`; + + const minutes = seconds / 60; + if (minutes < 60) return `${Math.floor(minutes)}분 전`; + + const hours = minutes / 60; + if (hours < 24) return `${Math.floor(hours)}시간 전`; + + const days = hours / 24; + if (days < 7) return `${Math.floor(days)}일 전`; + + const weeks = days / 7; + if (weeks < 5) return `${Math.floor(weeks)}주 전`; + + const months = days / 30; + if (months < 12) return `${Math.floor(months)}개월 전`; + + const years = days / 365; + return `${Math.floor(years)}년 전`; +}; + +export default getTimeElapsed; From a4d823977af28b913ac4e08bced83d25253a29d2 Mon Sep 17 00:00:00 2001 From: Jeongmin Oh Date: Fri, 5 Jul 2024 23:16:24 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat(CommentList):=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=EA=B0=80=20=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=B2=98=EB=A6=AC=ED=95=98=EB=8A=94=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/Img_inquiry_empty.png | Bin 0 -> 20946 bytes src/components/ProductDetail/CommentList.css | 32 +++++++-- src/components/ProductDetail/CommentList.jsx | 70 ++++++++++++------- 3 files changed, 69 insertions(+), 33 deletions(-) create mode 100644 src/assets/images/Img_inquiry_empty.png diff --git a/src/assets/images/Img_inquiry_empty.png b/src/assets/images/Img_inquiry_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..46dc924ab2a6cc2ac2de0aa37c32a02c8ce8a941 GIT binary patch literal 20946 zcmeFY^;cWZ7cLAGmjcD5SZQeqt}X6ftdQXDP~6=q6f4EuEy1Bka4#+mRQ565-S0qoJV@DJ#ioqoHBw{rADeMqTN) z$y`PK!*f;A_dr8qe*fPGT|S-H40RFRLt9Y>t#*q30QCjaR{Enf8d^gV!M!;a8k&}^ zvYfPzFZ#(EK`^=E!rlX!{_7%DJmt_c=T_f}i_Ravv1@uQu!aFVCSfNO)IhUNjBN_) zy538CR#!`#_yXd?M^9)_h7?FAjfRX(6$`_&O4Y{NYWPgFL{Wx_x=JPMNyP0>BrfXC z|L^brh6VU+FwxLb$L6{M_*+iauyW))-lX)rS(uO;o;pEtI-Y(WGH7>EYcvAqq_vua z1nKh#U~-_LsYuD{231^tBlt*wc+=I`xZA%}tcUcXPvDs9ar2f>ro*5_Lt{XmP8k#F z6x>i$C;o663|3zn!$BuNLnG!~YZnGJ)o{Dx0;hQ_YI8<|?{4V!D6z7b%+S#`vvM|` zrWI3IL95383els~`kpQzJcEc=|FwNH+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L5LzU{+KrFo6aHSF8F z>S2~+tk9s*tT0bMow-{sYG0UX0ipCuNt!^hq_?aOu*Q%L#ET?|ck%Tzlz=xi6jWRck^>Q{Oas zB*(TbhmwL+!A>veb^c4P{g-$w+ex9>*s?0Q;eE5yXjqE{%hWn95(NNMR0r~xGAi@= zK%gMS^Yd@nW-EDe5w~i&0_y%>bOI(PX00xX0A1i+bC&cdvj*-UyTfRn?qD=#H^O%_ z%C5aq54<~2??(lO2jwly9CXyKcZ^A=6>i_@% literal 0 HcmV?d00001 diff --git a/src/components/ProductDetail/CommentList.css b/src/components/ProductDetail/CommentList.css index f6020a340..4d7e6a850 100644 --- a/src/components/ProductDetail/CommentList.css +++ b/src/components/ProductDetail/CommentList.css @@ -1,20 +1,19 @@ -.ask-wrapper { +.add-inquiry-wrapper { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; - margin-bottom: 24px; width: 100%; } -.ask-label { +.inquiry-label { width: 100%; font-size: 16px; font-weight: normal; color: var(--gray900); } -.ask-content { +.inquiry-content { width: 100%; height: 104px; margin-top: 16px; @@ -24,13 +23,13 @@ border-radius: 12px; background-color: var(--gray100); } -.ask-content::placeholder { +.inquiry-content::placeholder { font-size: 16px; font-weight: normal; color: var(--gray400); } -.add-ask-button { +.add-inquiry-button { width: 74px; height: 42px; padding: auto 23px; @@ -42,7 +41,7 @@ color: var(--white); } -.add-ask-button.active { +.add-inquiry-button.active { background-color: var(--blue); cursor: pointer; } @@ -51,3 +50,22 @@ width: 100%; list-style: none; } + +.inquiry-wrapper { + width: 100%; + margin-bottom: 24px; +} + +.no-inquiry-wrapper { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.no-inquiry-text { + font-size: 16px; + font-weight: normal; + line-height: 24px; + color: var(--gray400); +} diff --git a/src/components/ProductDetail/CommentList.jsx b/src/components/ProductDetail/CommentList.jsx index 82c7940ef..ef22f27ae 100644 --- a/src/components/ProductDetail/CommentList.jsx +++ b/src/components/ProductDetail/CommentList.jsx @@ -1,6 +1,8 @@ import { useState } from "react"; import "./CommentList.css"; +import inquiryEmptyImage from "../../assets/images/Img_inquiry_empty.png"; + import Comment from "./Comment"; function CommentList({ comments }) { @@ -11,38 +13,54 @@ function CommentList({ comments }) { }; const buttonClassName = isInputFill - ? "add-ask-button active" - : "add-ask-button"; + ? "add-inquiry-button active" + : "add-inquiry-button"; const placeholder = "개인정보를 공유 및 요청하거나 명예 훼손, 무단 광고, 불법 정보 유포 시 모니터링 후 삭제될 수 있으며, " + "이에 대한 민형사상 책임은 게시자에게 있습니다."; return ( -
- - - - -
    - {comments.map((comment) => { - return ( -
  • - -
  • - ); - })} -
-
+ <> +
+ + + +
+ +
+ {comments.length !== 0 ? ( +
    + {comments.map((comment) => { + return ( +
  • + +
  • + ); + })} +
+ ) : ( +
+ 아직 문의가 없습니다. +
아직 문의가 없습니다.
+
+ )} +
+ ); } From 32cd55bd8a618ee2a6f9de99c6ac840ff82e1cc4 Mon Sep 17 00:00:00 2001 From: Jeongmin Oh Date: Fri, 5 Jul 2024 23:21:00 +0900 Subject: [PATCH 7/8] =?UTF-8?q?rename:=20jsx=20=EC=BD=94=EB=93=9C=EB=A5=BC?= =?UTF-8?q?=20=EB=A6=AC=ED=84=B4=ED=95=98=EB=8A=94=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EC=9D=98=20=ED=99=95=EC=9E=A5=EC=9E=90?= =?UTF-8?q?=EB=A5=BC=20js=EC=97=90=EC=84=9C=20jsx=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/{Nav.js => Nav.jsx} | 0 src/components/additem/{AddItemForm.js => AddItemForm.jsx} | 0 src/components/additem/{FileInput.js => FileInput.jsx} | 0 src/components/additem/{TextInput.js => TextInput.jsx} | 0 src/components/items/{AllProductList.js => AllProductList.jsx} | 0 src/components/items/{BestProductList.js => BestProductList.jsx} | 0 src/components/items/{ProductListItem.js => ProductListItem.jsx} | 0 src/pages/{AddItemPage.js => AddItemPage.jsx} | 0 src/pages/{ItemsPage.js => ItemsPage.jsx} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename src/components/{Nav.js => Nav.jsx} (100%) rename src/components/additem/{AddItemForm.js => AddItemForm.jsx} (100%) rename src/components/additem/{FileInput.js => FileInput.jsx} (100%) rename src/components/additem/{TextInput.js => TextInput.jsx} (100%) rename src/components/items/{AllProductList.js => AllProductList.jsx} (100%) rename src/components/items/{BestProductList.js => BestProductList.jsx} (100%) rename src/components/items/{ProductListItem.js => ProductListItem.jsx} (100%) rename src/pages/{AddItemPage.js => AddItemPage.jsx} (100%) rename src/pages/{ItemsPage.js => ItemsPage.jsx} (100%) diff --git a/src/components/Nav.js b/src/components/Nav.jsx similarity index 100% rename from src/components/Nav.js rename to src/components/Nav.jsx diff --git a/src/components/additem/AddItemForm.js b/src/components/additem/AddItemForm.jsx similarity index 100% rename from src/components/additem/AddItemForm.js rename to src/components/additem/AddItemForm.jsx diff --git a/src/components/additem/FileInput.js b/src/components/additem/FileInput.jsx similarity index 100% rename from src/components/additem/FileInput.js rename to src/components/additem/FileInput.jsx diff --git a/src/components/additem/TextInput.js b/src/components/additem/TextInput.jsx similarity index 100% rename from src/components/additem/TextInput.js rename to src/components/additem/TextInput.jsx diff --git a/src/components/items/AllProductList.js b/src/components/items/AllProductList.jsx similarity index 100% rename from src/components/items/AllProductList.js rename to src/components/items/AllProductList.jsx diff --git a/src/components/items/BestProductList.js b/src/components/items/BestProductList.jsx similarity index 100% rename from src/components/items/BestProductList.js rename to src/components/items/BestProductList.jsx diff --git a/src/components/items/ProductListItem.js b/src/components/items/ProductListItem.jsx similarity index 100% rename from src/components/items/ProductListItem.js rename to src/components/items/ProductListItem.jsx diff --git a/src/pages/AddItemPage.js b/src/pages/AddItemPage.jsx similarity index 100% rename from src/pages/AddItemPage.js rename to src/pages/AddItemPage.jsx diff --git a/src/pages/ItemsPage.js b/src/pages/ItemsPage.jsx similarity index 100% rename from src/pages/ItemsPage.js rename to src/pages/ItemsPage.jsx From 94aa1f3429fa6749ef1cd18cb17058813c391ec3 Mon Sep 17 00:00:00 2001 From: Jeongmin Oh Date: Fri, 5 Jul 2024 23:28:07 +0900 Subject: [PATCH 8/8] =?UTF-8?q?feat(ProductDetailPage):=20useEffect?= =?UTF-8?q?=EC=9D=98=20=EC=A2=85=EC=86=8D=EC=84=B1=20=EB=B0=B0=EC=97=B4?= =?UTF-8?q?=EC=97=90=20productId=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ProductDetailPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ProductDetailPage.jsx b/src/pages/ProductDetailPage.jsx index 90f0daed5..9a9974656 100644 --- a/src/pages/ProductDetailPage.jsx +++ b/src/pages/ProductDetailPage.jsx @@ -26,7 +26,7 @@ function ProductDetailPage() { setProductComments(data); } getProductComment(); - }, []); + }, [productId]); return (