-
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 24 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 |
---|---|---|
|
@@ -16,36 +16,46 @@ export interface SearchBarProps extends ComponentPropsWithoutRef<'input'> { | |
const SearchBar = ( | ||
{ onSearchClick, onInputChange, isMobile = false, ...props }: SearchBarProps, | ||
ref: ForwardedRef<HTMLInputElement>, | ||
) => ( | ||
<div css={S.searchBarStyling}> | ||
{isMobile ? ( | ||
<> | ||
<Button size="medium" variant="circle" onClick={onSearchClick}> | ||
<Search /> | ||
</Button> | ||
<input | ||
ref={ref} | ||
css={S.mobileInputStyling} | ||
placeholder="궁금한 키워드를 입력해주세요!" | ||
onChange={onInputChange} | ||
{...props} | ||
/> | ||
</> | ||
) : ( | ||
<> | ||
<input | ||
ref={ref} | ||
css={S.inputStyling} | ||
placeholder="궁금한 키워드를 입력해주세요!" | ||
onChange={onInputChange} | ||
{...props} | ||
/> | ||
<Button size="large" variant="circle" onClick={onSearchClick}> | ||
<Search /> | ||
</Button> | ||
</> | ||
)} | ||
</div> | ||
); | ||
) => { | ||
const handleInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (e.key === 'Enter') { | ||
onSearchClick(); | ||
} | ||
}; | ||
Comment on lines
+20
to
+24
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 ( | ||
<div css={S.searchBarStyling}> | ||
{isMobile ? ( | ||
<> | ||
<Button size="medium" variant="circle" onClick={onSearchClick}> | ||
<Search /> | ||
</Button> | ||
<input | ||
ref={ref} | ||
css={S.mobileInputStyling} | ||
placeholder="궁금한 키워드를 입력해주세요!" | ||
onChange={onInputChange} | ||
onKeyDown={handleInputKeyDown} | ||
{...props} | ||
/> | ||
</> | ||
) : ( | ||
<> | ||
<input | ||
ref={ref} | ||
css={S.inputStyling} | ||
placeholder="궁금한 키워드를 입력해주세요!" | ||
onChange={onInputChange} | ||
onKeyDown={handleInputKeyDown} | ||
{...props} | ||
/> | ||
<Button size="large" variant="circle" onClick={onSearchClick}> | ||
<Search /> | ||
</Button> | ||
</> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default forwardRef(SearchBar); |
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({ | ||
|
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.
💡 Codebase verification
디자인 시스템 변수 도입 권장
현재 테마 파일에 border-radius에 대한 디자인 토큰이 정의되어 있지 않습니다. 모바일 뷰의 스타일 변경은 적절해 보이나, 다음과 같은 개선사항을 제안드립니다:
🔗 Analysis chain
모바일 뷰의 스타일 변경사항 검토 필요
모바일 화면에서의 카테고리 버튼 스타일 변경이 적절해 보입니다. 다만, 다음 사항들을 확인해 주시면 좋겠습니다:
다음 스크립트를 실행하여 디자인 시스템 변수 사용 여부를 확인해 주세요:
Let's first try to find any design system related files and their content to make a more informed decision about the usage of design tokens or theme variables.
Let's check the theme file content to see if there are any predefined border-radius values that should be used instead of magic numbers.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 43
Script:
Length of output: 79331
Script:
Length of output: 1596