Search.js 689 Bytes
Newer Older
1
2
import styles from "./search.module.scss";

Kim, Subin's avatar
Kim, Subin committed
3
const Search = ({ search, setSearch, handleClick }) => {
Kim, Subin's avatar
수빈    
Kim, Subin committed
4
5
6
7
    function handleSearch(e) {
        const { name, value } = e.target
        setSearch({ ...search, [name]: value })
    }
Kim, Subin's avatar
Kim, Subin committed
8

9
10
    return (
        <div className="d-flex">
Kim, Subin's avatar
Kim, Subin committed
11
12
            <input className={`form-control ${search.type === "home" ? styles.searchWhite : `${styles.search}`}`} name="keyword" type="text" autoComplete="off" onChange={handleSearch} />
            <i className={`bi bi-search align-self-center ${search.type === "home" ? "text-white" : "mx-2"} ${styles.icon}`} onClick={handleClick} style={{ fontSize: "1.3rem" }}></i>
13
14
15
16
17
        </div>
    )
}

export default Search