-
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
[Feat] 탐색 페이지 검색바 구현 #62
Changes from 6 commits
545e64a
3f165c8
8d4a97f
351b7ba
a9f9626
116a003
924672f
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { SVGProps } from 'react'; | ||
|
||
const SvgIcSearchGray = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" {...props}> | ||
<path | ||
fill="#96A0B1" | ||
fillRule="evenodd" | ||
d="M4.149 11.04a6.891 6.891 0 1 1 12.226 4.363.75.75 0 0 1 .257.168l3 3a.75.75 0 0 1-1.061 1.06l-3-3a.75.75 0 0 1-.168-.256A6.891 6.891 0 0 1 4.149 11.04M11.04 5.65a5.391 5.391 0 1 0 0 10.783 5.391 5.391 0 0 0 0-10.783" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
); | ||
export default SvgIcSearchGray; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { SVGProps } from 'react'; | ||
|
||
const SvgIcXCircleGray = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" {...props}> | ||
<rect width={24} height={24} fill="#CFD3DE" rx={12} /> | ||
<path stroke="#fff" strokeLinecap="round" strokeWidth={2} d="m8 16 8-8M16 16 8 8" /> | ||
</svg> | ||
); | ||
export default SvgIcXCircleGray; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { default as IcBack } from './IcBack' | ||
export { default as IcClose } from './IcClose' | ||
export { default as IcClose } from './IcClose' | ||
export { default as IcSearchGray } from './IcSearchGray' | ||
export { default as IcXCircleGray } from './IcXCircleGray' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const searchGrayStyle = style({ | ||
position: 'absolute', | ||
|
||
top: 0, | ||
bottom: 0, | ||
left: 16, | ||
|
||
margin: 'auto 0', | ||
|
||
cursor: 'pointer', | ||
}); | ||
|
||
export const xCircleGrayStyle = style({ | ||
position: 'absolute', | ||
|
||
top: 0, | ||
bottom: 0, | ||
right: 12, | ||
|
||
margin: 'auto 0', | ||
|
||
cursor: 'pointer', | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { forwardRef } from 'react'; | ||
import Flex from '@/components/Flex'; | ||
import Input from '@/components/Input'; | ||
import { IcSearchGray, IcXCircleGray } from '@/assets/svg'; | ||
import { searchGrayStyle, xCircleGrayStyle } from './index.css'; | ||
|
||
interface SearchBarProps { | ||
searchValue: string; | ||
handleSearchChange: (value: string) => void; | ||
handleSearchIconClick: () => void; | ||
} | ||
|
||
const SearchBar = forwardRef<HTMLInputElement, SearchBarProps>( | ||
({ searchValue, handleSearchChange, handleSearchIconClick }, ref) => { | ||
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
handleSearchChange(event.target.value); | ||
}; | ||
|
||
const handleClearInput = () => { | ||
handleSearchChange(''); | ||
}; | ||
|
||
return ( | ||
<Flex align="center" width="29.9rem" height="4.4rem" position="relative" margin="0 0 0 1.2rem"> | ||
<IcSearchGray className={searchGrayStyle} width={24} onClick={handleSearchIconClick} /> | ||
<Input | ||
isSearch={true} | ||
ref={ref} | ||
value={searchValue} | ||
placeholder="장르나 댄서 네임을 검색해 보세요" | ||
onChange={handleInputChange} | ||
/> | ||
<IcXCircleGray className={xCircleGrayStyle} width={24} onClick={handleClearInput} /> | ||
</Flex> | ||
Comment on lines
+23
to
+34
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. 여기 Flex에 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.
해당 작업을 한 브랜치는 아직 |
||
); | ||
} | ||
); | ||
|
||
SearchBar.displayName = 'SearchBar'; | ||
|
||
Comment on lines
+38
to
+40
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. 여기 확인한번 해주세요! 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 default SearchBar; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
import { useState } from 'react'; | ||
import SearchBar from '@/pages/search/components/SearchBar'; | ||
import Header from '@/components/Header'; | ||
|
||
const Search = () => { | ||
return <div>search</div>; | ||
const [searchValue, setSearchValue] = useState(''); | ||
|
||
const handleSearchChange = (value: string) => { | ||
setSearchValue(value); | ||
}; | ||
|
||
const handleSearchIconClick = () => { | ||
console.log(searchValue); | ||
}; | ||
|
||
return ( | ||
<Header.Root> | ||
<Header.BackIcon /> | ||
<SearchBar | ||
searchValue={searchValue} | ||
handleSearchChange={handleSearchChange} | ||
handleSearchIconClick={handleSearchIconClick} | ||
/> | ||
</Header.Root> | ||
); | ||
}; | ||
|
||
export default Search; |
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.
여기 top과 bottom이 동시에 있는 이유가 있나요?
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.
불필요한 코드 삭제했습니다!