-
Notifications
You must be signed in to change notification settings - Fork 35
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
[김민찬] Sprint9 #296
Merged
lisarnjs
merged 13 commits into
codeit-bootcamp-frontend:Next-김민찬
from
itscold96:Next-김민찬-Sprint10
Aug 20, 2024
The head ref may contain hidden characters: "Next-\uAE40\uBBFC\uCC2C-Sprint10"
Merged
[김민찬] Sprint9 #296
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
df4bc92
refactor(mentor): QueryClient를 Laytout 컴포넌트로 이동
itscold96 97f6bf7
refactor(borads): 내부 컴포넌트 모듈화
itscold96 402c7da
remove:리액트에서 사용했던 CustomImage 공용 컴포넌트 제거
itscold96 51d9fbb
design(ArticleSection): 불필요한 마진 제거
itscold96 19e3e99
refactor: getArticles 함수 내부에 URLSearchParams api 적용
itscold96 2e1f4f2
refactor(mentor): 반응형 쿼리 mixin으로 수정
itscold96 b858ecd
refactor: getArticles 함수 에러 분기 처리
itscold96 6ab7162
refactor: Article 영역 하위 컴포넌트 내부 변수명을 직관적으로 변경
itscold96 8b6dd2a
design: reset css 추가
itscold96 380954c
refactor: 정렬 드롭다운 모듈화
itscold96 0cf87c3
refector: useWindowSize 훅을 리팩토링
itscold96 5c21947
rename: props로 이름지어져있던 함수의 interface를 params로 변경
itscold96 daa2055
refactor: 화면 너비에 따른 동적 페이지 사이즈를 반환하는 커스텀 훅 제작
itscold96 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 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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,68 @@ | ||
@import '/styles/variables'; | ||
|
||
.dropdownWrapper { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-shrink: 0; | ||
|
||
position: relative; | ||
height: 42px; | ||
width: 130px; | ||
|
||
font-size: 16px; | ||
font-weight: 400; | ||
line-height: 24px; | ||
border-radius: 12px; | ||
|
||
color: var(--cool-gray-800); | ||
background-color: var(--white); | ||
border: 1px solid var(--cool-gray-200); | ||
|
||
cursor: pointer; | ||
|
||
@include underTablet { | ||
width: 120px; | ||
} | ||
|
||
@include mobile { | ||
width: 42px; | ||
border-radius: 12px; | ||
} | ||
} | ||
|
||
.dropdownTrigger { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
& span { | ||
width: 66px; | ||
} | ||
} | ||
|
||
.dropdownMenu { | ||
position: absolute; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
width: 130px; | ||
height: 84px; | ||
top: 46px; | ||
right: 0; | ||
border-radius: 12px; | ||
|
||
background-color: var(--white); | ||
border: 1px solid var(--cool-gray-200); | ||
|
||
& li { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
|
||
&:not(:last-child) { | ||
border-bottom: 1px solid var(--cool-gray-200); | ||
} | ||
} | ||
} |
This file contains 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,58 @@ | ||
import styles from './OrderByDropdown.module.scss'; | ||
import sortIcon from '@/public/images/market/sort-icon.png'; | ||
import dropDownIcon from '@/public/images/market/order-dropdown.png'; | ||
import { DEVICE_MAX_WIDTH } from '@/constants/mediaQuerySize'; | ||
import Image from 'next/image'; | ||
|
||
import useToggle from '@/hooks/customs/useToggle'; | ||
import { useState } from 'react'; | ||
import useInnerWidth from '@/hooks/customs/useInnerWidth'; | ||
|
||
interface OrderByDropdownProps { | ||
onMenuClick: (orderBy: string) => void; | ||
} | ||
|
||
const orderByList = [ | ||
{ name: '최신순', value: 'recent' }, | ||
{ name: '좋아요순', value: 'like' }, | ||
]; | ||
|
||
function OrderByDropdown({ onMenuClick }: OrderByDropdownProps) { | ||
const innerWidth = useInnerWidth(); | ||
const [isDropdownOpen, toggleDropdown] = useToggle(); | ||
const [selectedItem, setSelectedItem] = useState(orderByList[0]); | ||
|
||
const handleMenuClick = (event: React.MouseEvent<HTMLUListElement>) => { | ||
const { name, value } = (event.target as HTMLUListElement).dataset; | ||
if (name && value) { | ||
onMenuClick(value); | ||
setSelectedItem({ name, value }); | ||
} | ||
toggleDropdown(); | ||
}; | ||
|
||
return ( | ||
<div className={styles.dropdownWrapper}> | ||
<div className={styles.dropdownTrigger} onClick={toggleDropdown}> | ||
{innerWidth > DEVICE_MAX_WIDTH.mobile && <span>{selectedItem.name}</span>} | ||
<Image | ||
src={innerWidth > DEVICE_MAX_WIDTH.mobile ? dropDownIcon : sortIcon} | ||
alt={'드롭다운 열기 아이콘'} | ||
height={24} | ||
width={24} | ||
/> | ||
</div> | ||
{isDropdownOpen && ( | ||
<ul className={styles.dropdownMenu} onClick={handleMenuClick}> | ||
{orderByList.map((item) => ( | ||
<li key={item.value} data-name={item.name} data-value={item.value}> | ||
{item.name} | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default OrderByDropdown; |
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.
오호 좋아요~~! 이제 scss 간지나게 사용하시겠군요 :)