-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor: 검색 결과 페이지 리팩토링 #265
Changes from 17 commits
3b2f596
134f35f
5a84545
16c1f0e
c12ecb3
7e3f0f2
ac85c41
a7e3512
5afac4d
a76e1c2
1ff849e
1f043c5
431d464
1003465
01b3652
973be01
2b52bd0
cf44e5c
c830c21
f9cca59
99f7680
0cbac16
37316ee
07f9f07
d32a8b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import color from '@/styles/color'; | |
import typo from '@/styles/typo'; | ||
|
||
export const searchTalkPickItemStyle = css({ | ||
all: 'unset', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 버튼과 관련된 부분에 기본 속성을 제거해주신 부분 좋습니다! |
||
display: 'flex', | ||
flexDirection: 'row', | ||
width: '1065px', | ||
|
@@ -36,12 +37,13 @@ export const dateStyle = css(typo.Number.Regular, { | |
}); | ||
|
||
export const contentWrapStyle = css({ | ||
display: 'flex', | ||
display: 'inline', | ||
height: '45px', | ||
overflowY: 'hidden', | ||
}); | ||
|
||
export const contentStyle = (highlighted: boolean) => | ||
css(typo.Comment.Regular, { | ||
overflowY: 'hidden', | ||
height: '45px', | ||
color: highlighted ? color.MAIN : color.GY[1], | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
import React from 'react'; | ||
import ContentsButton, { | ||
ContentsButtonProps, | ||
} from '@/components/molecules/ContentsButton/ContentsButton'; | ||
import { GameListItem } from '@/types/search'; | ||
WonJuneKim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import ContentsButton from '@/components/molecules/ContentsButton/ContentsButton'; | ||
import { PATH } from '@/constants/path'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import * as S from './SearchGameList.style'; | ||
|
||
export type GameItem = Pick< | ||
ContentsButtonProps, | ||
'title' | 'mainTag' | 'subTag' | ||
> & { | ||
optionAImg?: string; | ||
optionBImg?: string; | ||
id: number; | ||
}; | ||
|
||
export interface SearchGameListProps { | ||
gameList: GameItem[]; | ||
gameList: GameListItem[]; | ||
keyword: string; | ||
} | ||
|
||
const SearchGameList = ({ gameList, keyword }: SearchGameListProps) => { | ||
const navigate = useNavigate(); | ||
|
||
const handleItemClick = (gameId: number) => { | ||
navigate(`/balancegame/${gameId}`); | ||
navigate(`/${PATH.BALANCEGAME(gameId)}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 경로 상수화 처리 감사합니다~ |
||
}; | ||
|
||
return ( | ||
|
@@ -38,7 +29,7 @@ const SearchGameList = ({ gameList, keyword }: SearchGameListProps) => { | |
showBookmark={false} | ||
size="small" | ||
keyword={keyword} | ||
onClick={() => handleItemClick(game.id)} | ||
onClick={() => handleItemClick(game.gameSetId)} | ||
/> | ||
))} | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,12 +39,13 @@ export const loggedOutContainerStyling = css({ | |
display: 'flex', | ||
position: 'absolute', | ||
top: '90px', | ||
left: '-100px', | ||
left: '50%', | ||
transform: 'translateX(-50%)', | ||
width: '1215px', | ||
height: '260px', | ||
backdropFilter: 'blur(11px)', | ||
backgroundColor: 'rgba(255, 255, 255, 0.01)', | ||
zIndex: 1, | ||
zIndex: '1', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 보통 zIndex는 숫자로 사용하는데 string으로 변경하신 이유가 있을까용? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 다른 스타일들과의 통일을 위해 문자열로 수정해주었습니다,, ㅎㅎ 🫢 |
||
}); | ||
|
||
export const toastModalStyling = css({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { useState, useEffect } from 'react'; | ||
import { useSearchParams } from 'react-router-dom'; | ||
|
||
const usePagination = (defaultPage = 0) => { | ||
const usePagination = (defaultPage = 1) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사실 이 부분이 0으로 처리되고, 해당 훅 호출 부에서 +1을 해서 사용하는 방식이 많길래 건들면 파장이 클까바 냅두고 있었어요! |
||
const [searchParams, setSearchParams] = useSearchParams(); | ||
|
||
const initialPage = | ||
parseInt(searchParams.get('page') || `${defaultPage}`, 10) || 0; | ||
parseInt(searchParams.get('page') || `${defaultPage}`, 10) || 1; | ||
const [page, setPage] = useState(initialPage); | ||
|
||
useEffect(() => { | ||
|
@@ -16,7 +16,7 @@ const usePagination = (defaultPage = 0) => { | |
}, [page, setSearchParams]); | ||
|
||
const handlePageChange = (newPage: number) => { | ||
setPage(newPage - 1); | ||
setPage(newPage); | ||
}; | ||
|
||
return { page, handlePageChange }; | ||
|
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.
검색 시 엔터 키로 실행하도록 수정한 부분은 사용자 편의성에 좋은거 같네용ㅎㅎ