-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from msdio/feature/client/typing-long-sort
[#325] 긴 글 목록 페이지 정렬 기능 추가
- Loading branch information
Showing
7 changed files
with
95 additions
and
24 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Flex, Menu, MenuButton, MenuDivider, MenuItem, MenuList } from '@chakra-ui/react'; | ||
import Link from 'next/link'; | ||
|
||
import { PRACTICE_LONG_PATH_LIST } from '@/constants/paths'; | ||
import UpDownArrow from '@/icons/UpDownArrow'; | ||
|
||
const sortByItems = [ | ||
{ | ||
label: '최신순', | ||
path: `${PRACTICE_LONG_PATH_LIST}?page=1&sortBy=latest`, | ||
}, | ||
{ | ||
label: '조회수순', | ||
path: `${PRACTICE_LONG_PATH_LIST}?page=1&sortBy=viewCount`, | ||
}, | ||
{ | ||
label: '오래된순', | ||
path: `${PRACTICE_LONG_PATH_LIST}?page=1&sortBy=oldest`, | ||
}, | ||
]; | ||
|
||
export default function SortBy() { | ||
return ( | ||
<Menu> | ||
<MenuButton | ||
fontWeight={'500'} | ||
w={'96px'} | ||
h={'34px'} | ||
border={'0.6px solid #101010'} | ||
borderRadius={16} | ||
bg={'background.white'} | ||
> | ||
<Flex alignItems={'center'} justify={'center'} gap={'15px'}> | ||
정렬 | ||
<UpDownArrow /> | ||
</Flex> | ||
</MenuButton> | ||
<MenuList p={0} minW={0} w={'96px'} border={'0.6px solid #101010'} borderRadius={16} bg={'background.white'}> | ||
{sortByItems.map((item, index, items) => ( | ||
<> | ||
<Link key={index} href={item.path}> | ||
<MenuItem | ||
_hover={{ color: 'primary.dark' }} | ||
fontWeight={'500'} | ||
w={'fit-content'} | ||
bg={'background.white'} | ||
p={0} | ||
m={'15px 18px'} | ||
> | ||
{item.label} | ||
</MenuItem> | ||
</Link> | ||
{index !== items.length - 1 && <MenuDivider />} | ||
</> | ||
))} | ||
</MenuList> | ||
</Menu> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import { Icon } from '@chakra-ui/react'; | ||
|
||
export default function UpDownArrow() { | ||
return ( | ||
<svg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'> | ||
<Icon width='9px' height='12px' viewBox='0 0 9 12' fill='none' xmlns='http://www.w3.org/2000/svg'> | ||
<path | ||
d='M6 8.5L3.5 11L1 8.5M1 3.5L3.5 1L6 3.5' | ||
d='M8 8.5L4.5 11L1 8.5M1 3.5L4.5 1L8 3.5' | ||
stroke='black' | ||
strokeWidth='1.2' | ||
strokeLinecap='round' | ||
strokeLinejoin='round' | ||
/> | ||
</svg> | ||
</Icon> | ||
); | ||
} |
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 @@ | ||
export type SortBy = 'latest' | 'oldest' | 'viewcount'; |