-
Notifications
You must be signed in to change notification settings - Fork 39
[박광민] sprint6 #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
GANGYIKIM
merged 24 commits into
codeit-bootcamp-frontend:React-박광민
from
minimo-9:React-박광민-sprint6
May 14, 2025
The head ref may contain hidden characters: "React-\uBC15\uAD11\uBBFC-sprint6"
Merged
[박광민] sprint6 #201
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0d61621
fix: Pagination 컴포넌트의 페이지 계산 로직 개선 및 버튼 타입 추가
minimo-9 6a3ca26
fix: SearchBar 컴포넌트의 props 이름을 searchTerm에서 keyword로 변경
minimo-9 41894fd
fix: SearchBar 컴포넌트의 props를 searchTerm에서 keyword로 변경하고 useSearchParam…
minimo-9 d2fe926
fix: SearchBar 컴포넌트의 포커스 시 테두리 스타일 수정
minimo-9 7c23160
fix: SortSelector 컴포넌트에 value prop 추가 및 선택된 정렬 상태 표시 개선
minimo-9 3675dc0
fix: SortSelector 컴포넌트에 value prop 추가 및 SearchBar 컴포넌트의 keyword prop 적용
minimo-9 9f68c32
fix: SortSelector 컴포넌트의 정렬 로직 단순화 및 선택된 정렬 상태 표시 개선
minimo-9 1ef9bc1
fix: AllProducts 컴포넌트의 검색 및 정렬 핸들러를 useCallback으로 최적화
minimo-9 78217de
fix: AllProducts 컴포넌트의 페이지 크기 계산 로직 개선
minimo-9 949fdaf
fix: AllProducts 컴포넌트에서 페이지 변경 시 sessionStorage 업데이트 로직 제거 및 제품 목록 렌더…
minimo-9 137213b
fix: setSearchParams에 replace 옵션 추가하여 검색 및 정렬 시 페이지 변경 시 URL 업데이트 개선
minimo-9 28e7290
feat: plus-icon.svg 파일 추가
minimo-9 91d3d43
feat: close-icon.svg 파일 추가
minimo-9 eab222d
fix: useLocation 훅을 추가하여 현재 경로에 따라 링크 스타일 개선
minimo-9 d57591c
feat: close-icon.svg 크기 및 경로 수정
minimo-9 dc5f952
fix: 검색바 높이 및 패딩 수정
minimo-9 17eac06
fix: AddItem 경로 수정
minimo-9 8e6aead
feat: 이미지 업로드 컴포넌트 및 스타일 추가
minimo-9 3396fa3
feat: 상품 소개 컴포넌트 및 스타일 추가
minimo-9 dd5e92a
feat: 상품명 입력 컴포넌트 및 스타일 추가
minimo-9 f56c4bc
feat: 가격 입력 컴포넌트 및 스타일 추가
minimo-9 8a33f59
feat: 태그 입력 컴포넌트 및 스타일 추가
minimo-9 05af39b
feat: 상품 등록 컴포넌트 및 스타일 추가
minimo-9 cbc757c
feat: AddItem 스타일 추가
minimo-9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { useState } from "react"; | ||
| import plusIcon from "./../../assets/icon/plus-icon.svg"; | ||
| import closeIcon from "./../../assets/icon/close-icon.svg"; | ||
| import styles from "./ImageUpload.module.css"; | ||
|
|
||
| const ImageUpload = ({ image, onImageChange }) => { | ||
| const [error, setError] = useState(""); | ||
|
|
||
| const handleChange = (e) => { | ||
| const file = e.target.files[0]; | ||
|
|
||
| if (!file) return; | ||
|
|
||
| if (image) { | ||
| setError("*이미지 등록은 최대 1개까지 가능합니다."); | ||
| return; | ||
| } | ||
|
|
||
| const reader = new FileReader(); | ||
| reader.onloadend = () => { | ||
| setError(""); | ||
| onImageChange(reader.result); | ||
| }; | ||
| reader.readAsDataURL(file); | ||
| }; | ||
|
|
||
| const handleRemove = () => { | ||
| setError(""); | ||
| onImageChange(null); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={styles.imageUpload}> | ||
| <h2 className={styles.label}>상품 이미지</h2> | ||
| <div className={styles.imageRow}> | ||
| <label className={styles.uploadBox}> | ||
| <img src={plusIcon} alt="추가 아이콘" className={styles.plus} /> | ||
| <p className={styles.text}>이미지 등록</p> | ||
| <input | ||
| type="file" | ||
| accept="image/*" | ||
| onChange={handleChange} | ||
| className={styles.uploadInput} | ||
| /> | ||
| </label> | ||
|
|
||
| {image && ( | ||
| <div className={styles.previewBox}> | ||
| <img src={image} alt="미리보기" className={styles.previewImage} /> | ||
| <button onClick={handleRemove} className={styles.removeButton}> | ||
| <img src={closeIcon} alt="닫기 아이콘" className={styles.close} /> | ||
| </button> | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
| {error && <p className={styles.error}>{error}</p>} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default ImageUpload; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| .imageUpload { | ||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| max-width: 588px; | ||
| gap: 16px; | ||
| } | ||
|
|
||
| .label { | ||
| font-size: 18px; | ||
| font-weight: 700; | ||
| line-height: 26px; | ||
| color: #1f2937; | ||
| } | ||
|
|
||
| .imageRow { | ||
| display: flex; | ||
| width: 100%; | ||
| gap: 24px; | ||
| } | ||
|
|
||
| .uploadBox { | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: 100%; | ||
| max-width: 282px; | ||
| height: 282px; | ||
| border-radius: 12px; | ||
| background-color: #f3f4f6; | ||
| gap: 12px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .plus { | ||
| width: 48px; | ||
| height: auto; | ||
| } | ||
|
|
||
| .text { | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| line-height: 26px; | ||
| color: #9ca3af; | ||
| } | ||
|
|
||
| .uploadInput { | ||
| display: none; | ||
| } | ||
|
|
||
| .previewBox { | ||
| position: relative; | ||
| width: 100%; | ||
| max-width: 282px; | ||
| height: 282px; | ||
| } | ||
|
|
||
| .previewImage { | ||
| width: 100%; | ||
| height: 100%; | ||
| border: 1px solid #f9fafb; | ||
| border-radius: 12px; | ||
| object-fit: cover; | ||
| } | ||
|
|
||
| .removeButton { | ||
| position: absolute; | ||
| top: 12px; | ||
| right: 12px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .error { | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| line-height: 26px; | ||
| color: #f74747; | ||
| } | ||
|
|
||
| @media (max-width: 1023px) { | ||
| .uploadBox { | ||
| max-width: 168px; | ||
| height: 168px; | ||
| } | ||
|
|
||
| .previewBox { | ||
| max-width: 168px; | ||
| height: 168px; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { useId } from "react"; | ||
| import styles from "./ItemDescription.module.css"; | ||
|
|
||
| const ItemDescription = ({ value, onChange }) => { | ||
| const id = useId(); | ||
|
|
||
| return ( | ||
| <div className={styles.itemDescription}> | ||
| <label htmlFor={id} className={styles.label}> | ||
| 상품 소개 | ||
| </label> | ||
| <textarea | ||
| id={id} | ||
| value={value} | ||
| onChange={(e) => onChange(e.target.value)} | ||
| placeholder="상품 소개를 입력해주세요" | ||
| className={styles.textarea} | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default ItemDescription; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
input의 accept 속성은 유저가 어떤 파일을 올려야하는지에 대한 힌트를 제공하는 속성입니다.
유저는 파일 업로드시 accept의 명시된 확장자 이외의 파일도 올릴 수 있으므로
실제 upload 함수에서 한번더 확장자를 검사해주시는 것이 좋습니다.
(사용자가 업로드창에서 옵션을 열어 확장자를 바꾸면 아래처럼 보입니다)

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/accept