-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat: 검색 작업 중
- Loading branch information
Showing
8 changed files
with
158 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.inputContainer { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
margin-right: 24px; | ||
width: 300px; | ||
height: 36px; | ||
border: 1px solid #dcdcdc; | ||
border-radius: 5px; | ||
/* transition: border-color 0.3s ease-in-out; */ | ||
} | ||
|
||
.iconSearch { | ||
margin-left: 12px; | ||
color: #a4a4a4; | ||
} | ||
|
||
.searchBar { | ||
width: 250px; | ||
border: none; | ||
outline: none; | ||
border-radius: 6px; | ||
padding: 0px 6px; | ||
font-size: 14px; | ||
} |
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,41 @@ | ||
import React, { useState } from "react"; | ||
import styles from "@src/components/Search/SearchBar.module.css"; | ||
import { BiSearch } from "react-icons/bi"; | ||
|
||
// 검색 바 컴포넌트 | ||
interface SearchBarProps { | ||
onSearch: (searchTerm: string) => void; | ||
onSearchEnter: () => Promise<void>; | ||
} | ||
|
||
const SearchBar: React.FC<SearchBarProps> = ({ onSearch, onSearchEnter }) => { | ||
const [searchTerm, setSearchTerm] = useState<string>(""); | ||
|
||
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const value = event.target.value; | ||
setSearchTerm(value); | ||
onSearch(value); | ||
}; | ||
|
||
const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (event.key === "Enter") { | ||
onSearchEnter(); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className={styles.inputContainer}> | ||
<BiSearch className={styles.iconSearch}></BiSearch> | ||
<input | ||
type="text" | ||
placeholder="검색어를 입력하세요..." | ||
value={searchTerm} | ||
onChange={handleInputChange} | ||
onKeyDown={handleInputKeyDown} | ||
className={styles.searchBar} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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,4 +1,4 @@ | ||
// 제외 모달 스타일 컴포넌트 | ||
// 기본 모달 스타일 컴포넌트 | ||
|
||
import styled from "styled-components"; | ||
|
||
|
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
Oops, something went wrong.