Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
c11fae5
items에서 최신순/좋아요순 클릭 시 변경되는 이벤트 추가
kimsoyoung96 Dec 7, 2024
4cf5fcc
/items에서 베스트상품 기본 4개 띄우려고 slice 사용
kimsoyoung96 Dec 7, 2024
d1579e6
Home.jsx에서 필요없는 함수와 태그 삭제
kimsoyoung96 Dec 7, 2024
3d2f34e
form태그 스타일 삭제
kimsoyoung96 Dec 7, 2024
e547d7b
미디어쿼리에서 최대너비값 삭제 및 padding값 합치기
kimsoyoung96 Dec 7, 2024
188d21b
베스트아이템 영역을 grid로 바꾸고 미디어쿼리 추가
kimsoyoung96 Dec 7, 2024
c5f8598
전체상품 영역을 grid로 바꾸고 미디어쿼리 추가
kimsoyoung96 Dec 7, 2024
d355d71
상품검색영역에 미디어쿼리를 추가하고 flex 칸을 order로 위치변경
kimsoyoung96 Dec 7, 2024
0eea259
Additem.jsx에 form미디어쿼리 추가
kimsoyoung96 Dec 7, 2024
617ecaa
상품검색영역만 높이를 변경하도록 스타일 추가 및 변경
kimsoyoung96 Dec 7, 2024
61bc1a2
페이지네이션 레이아웃 추가
kimsoyoung96 Dec 8, 2024
b2271f6
Nav 따로 컴포넌트에서 작업(Home컴포넌트에 import가 많고, 중고마켓에 링크를 매번 적용시키기 위함)
kimsoyoung96 Dec 8, 2024
4595589
Nav 컴포넌트 변경에 따른 코드 수정
kimsoyoung96 Dec 8, 2024
b30d603
필요없는 컴포넌트들 삭제
kimsoyoung96 Dec 9, 2024
c81e548
코드리뷰 받은 에러처리, 예외처리 코드 반영
kimsoyoung96 Dec 9, 2024
d60f178
코드리뷰 받은 버튼타입 추가하기(text 프롭스를 유연하게 받아보는 방법은 반영까지 시간이 좀 더 필요할 것 같습니다)
kimsoyoung96 Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/assets/arrow_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 26 additions & 6 deletions src/components/BestItem.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
.Bestitem {
display: flex;
flex-direction: row;
display: grid;
grid-template-rows: 1fr;
grid-template-columns: repeat(4, 1fr);
gap: 24px;
margin-top: 16px;
overflow: hidden;
/* flex-wrap: wrap; */

@media (max-width: 1199px) {
grid-template-columns: repeat(2, 1fr);
.BestiemContainer:nth-child(n + 3) {
display: none;
}
padding-left: 24px;
padding-right: 24px;
}

@media (max-width: 767px) {
grid-template-columns: repeat(1, 1fr);
.BestiemContainer:nth-child(n + 2) {
display: none;
}
padding-left: 16px;
padding-right: 16px;
}
}

.Bestitem > div {
Expand All @@ -17,10 +34,13 @@
}

.Bestitem .itemImg img {
width: 282px;
height: 282px;
width: 100%;
height: auto;
border-radius: 16px;
margin-bottom: 10px;
object-fit: cover;
aspect-ratio: 1;
/* overflow: hidden; */
}

.itemName {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Bestitem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import favorit_img from '../assets/heart_favorit.png';
import './BestItem.css';

const Bestitem = ({ items }) => {
const limiteData = items.slice(0, 4);

return (
<div className="Bestitem">
{items.map((item) => {
{limiteData.map((item) => {
return (
<div className="BestiemContainer">
<div className="itemImg">{<img src={item.images} />}</div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import './Button.css';

const Button = ({ text, type }) => {
return <button className={`Button Button_${type}`}>{text}</button>;
return (
<button type={type} className={`Button Button_${type}`}>
{text}
</button>
);
};

export default Button;
15 changes: 14 additions & 1 deletion src/components/Editinput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@ const Editinput = ({ type, info, placeholder }) => {
const imgRef = useRef();

const saveImgFile = () => {
if (!imgRef.current || !imgRef.current.files[0]) {
console.error('파일이 선택되지 않았습니다.');
return;
}
Comment on lines +10 to +13
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍👍👍


const file = imgRef.current.files[0];
const reader = new FileReader();

reader.readAsDataURL(file);

reader.onloadend = () => {
setImgFile(reader.result);
if (reader.result) {
setImgFile(reader.result); // reader.result는 base64 데이터 URL
}
};

reader.onerror = () => {
console.error('파일을 읽는 도중 에러가 발생했습니다.');
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/components/Edittext.jsx

This file was deleted.

22 changes: 22 additions & 0 deletions src/components/Itemtitle.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@
gap: 12px;
height: 32px;
white-space: nowrap;
flex-wrap: wrap;
align-items: stretch;
}

@media (max-width: 767px) {
.search {
height: 92px;
}
.Item_text:nth-child(1) {
order: 1;
}

.Item_input:nth-child(2) {
order: 3;
}

.Item_button:nth-child(3) {
order: 2;
}
.Item_select:nth-child(4) {
order: 4;
}
}

.Itemtitle .Item_text {
Expand Down
6 changes: 1 addition & 5 deletions src/components/Nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
align-items: center;
border-bottom: 1px solid #dfdfdf;
gap: 47px;
padding: 10px 0 9px;
padding: 10px 200px 9px 200px;

@media (max-width: 1920px) {
padding-left: 200px;
padding-right: 200px;
}
@media (max-width: 1199px) {
padding-left: 24px;
padding-right: 24px;
Expand Down
21 changes: 15 additions & 6 deletions src/components/Nav.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import './Nav.css';
import Button from './Button';
import Nav_logo from '../assets/nav_panda_logo_img.png';
import Nav_user from '../assets/nav_user_img.png';
import { Link } from 'react-router-dom';

const Nav = ({ leftChild, center, rightChild }) => {
const Nav = () => {
return (
<nav className="Nav">
<div className="nav_logo">{leftChild}</div>
<div className="nav_center">{center}</div>
<div className="nav_user">{rightChild}</div>
</nav>
<div className="Nav">
<img src={Nav_logo} />
<div className="nav_button nav_center">
<Button text={'자유게시판'} />
<Link to="/items">
<Button text={'중고마켓'} type={'nav_activate'} />
</Link>
</div>
<img className="nav_user" src={Nav_user} />
</div>
);
};

Expand Down
5 changes: 0 additions & 5 deletions src/components/Pagenation.jsx

This file was deleted.

30 changes: 25 additions & 5 deletions src/components/Totalitem.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
.Totalitems {
display: flex;
flex-direction: row;
display: grid;
grid-template-rows: 2fr;
grid-template-columns: repeat(5, 1fr);
gap: 24px;
margin-top: 16px;
flex-wrap: wrap;

@media (max-width: 1199px) {
grid-template-columns: repeat(3, 1fr);
.TotaliemContainer:nth-child(n + 7) {
display: none;
}
padding-left: 24px;
padding-right: 24px;
}

@media (max-width: 767px) {
grid-template-columns: repeat(2, 1fr);
.TotaliemContainer:nth-child(n + 5) {
display: none;
}
padding-left: 16px;
padding-right: 16px;
}
}

.Totalitems > div {
Expand All @@ -16,10 +34,12 @@
}

.Totalitems .itemImg img {
width: 221px;
height: 221px;
width: 100%;
height: auto;
border-radius: 16px;
margin-bottom: 10px;
object-fit: cover;
aspect-ratio: 1;
}

.itemName {
Expand Down
5 changes: 1 addition & 4 deletions src/pages/Additem.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
form {
@media (max-width: 1920px) {
padding-left: 200px;
padding-right: 200px;
}
@media (max-width: 1199px) {
padding-left: 24px;
padding-right: 24px;
}

@media (max-width: 767px) {
padding-left: 16px;
padding-right: 16px;
Expand Down
27 changes: 6 additions & 21 deletions src/pages/Additem.jsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
import './Additem.css';
import Nav from '../components/Nav';
import Nav_logo from '../assets/nav_panda_logo_img.png';
import Nav_user from '../assets/nav_user_img.png';
import Button from '../components/Button';
import Itemtitle from '../components/Itemtitle';
import Editsection from '../components/Editsection';
import Edittext from '../components/Edittext';
import Editinput from '../components/Editinput';
import { Link } from 'react-router-dom';

const Additem = () => {
return (
<div className="Additem">
<Nav
leftChild={<img src={Nav_logo} />}
center={
<div className="nav_button">
<Button text={'자유게시판'} />
<Link to="/items">
<Button text={'중고마켓'} type={'nav_activate'} />
</Link>
</div>
}
rightChild={<img src={Nav_user} />}
/>
<Nav />
{/* 아래는 상품등록 페이지 구현 */}
<form className="edit">
<div className="edit_title">
Expand All @@ -34,17 +19,17 @@ const Additem = () => {
</div>
<div className="edit_info">
<Editsection
topChlid={<Edittext text={'상품 이미지'} />}
topChlid={'상품이미지'}
center={<Editinput type={'img'} />}
/>
<Editsection
topChlid={<Edittext text={'상품명'} />}
topChlid={'상품명'}
center={
<Editinput info={'name'} placeholder={'상품명을 입력해주세요'} />
}
/>
<Editsection
topChlid={<Edittext text={'상품 소개'} />}
topChlid={'상품 소개'}
center={
<Editinput
info={'info'}
Expand All @@ -53,7 +38,7 @@ const Additem = () => {
}
/>
<Editsection
topChlid={<Edittext text={'판매가격'} />}
topChlid={'판매가격'}
center={
<Editinput
info={'price'}
Expand All @@ -62,7 +47,7 @@ const Additem = () => {
}
/>
<Editsection
topChlid={<Edittext text={'태그'} />}
topChlid={'태그'}
center={
<Editinput info={'tag'} placeholder={'태그를 입력해주세요'} />
}
Expand Down
46 changes: 31 additions & 15 deletions src/pages/Home.css
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
form {
@media (max-width: 1920px) {
padding-left: 200px;
padding-right: 200px;
}
@media (max-width: 1199px) {
padding-left: 24px;
padding-right: 24px;
}
@media (max-width: 767px) {
padding-left: 16px;
padding-right: 16px;
}
}

.item_title {
margin-top: 24px;
font-size: 20px;
font-weight: 700;
line-height: 32px;

@media (max-width: 1199px) {
padding: 0 24px;
}

@media (max-width: 767px) {
padding: 0 16px;
}
}

.Home .item {
Expand All @@ -29,3 +22,26 @@ form {
a:link {
text-decoration: none;
}

.pagenation_box {
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: 43px 0 53px;
}

.page_button {
width: 40px;
height: 40px;
border-radius: 50%;
border: 1px solid #e5e7eb;
outline: none;
color: #6b7280;
cursor: pointer;
}

.active {
background-color: #2f80ed;
color: #f9fafb;
}
Loading
Loading