-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented search functionality in Explore page
- Loading branch information
1 parent
d14da37
commit e6e628a
Showing
5 changed files
with
151 additions
and
6 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,28 @@ | ||
import React, { useState } from "react"; | ||
import { LuSearch } from "react-icons/lu"; | ||
import styles from "./SearchBox.module.css"; | ||
|
||
const SearchBox = ({ onSearch }) => { | ||
const [query, setQuery] = useState(""); | ||
const handleInputChange = (e) => { | ||
setQuery(e.target.value); | ||
onSearch(e.target.value); | ||
}; | ||
|
||
return ( | ||
<div className={styles.searchBoxWrapper}> | ||
<div className={styles.group}> | ||
<LuSearch className={styles.searchIcon} /> | ||
<input | ||
type="text" | ||
value={query} | ||
onChange={handleInputChange} | ||
className={styles.input} | ||
placeholder="Search..." | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SearchBox; |
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,84 @@ | ||
.searchBoxWrapper { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.group { | ||
display: flex; | ||
line-height: 28px; | ||
align-items: center; | ||
position: relative; | ||
max-width: 190px; | ||
} | ||
|
||
.searchIcon { | ||
cursor: pointer; | ||
position: absolute; | ||
left: 1rem; | ||
width: 1rem; | ||
height: 1rem; | ||
} | ||
|
||
.input { | ||
width: 100%; | ||
height: 40px; | ||
line-height: 28px; | ||
padding: 0 1rem; | ||
padding-left: 2.5rem; | ||
border: 1px solid var(--input-border-color); | ||
border-radius: 8px; | ||
outline: none; | ||
color: var(--text-color); | ||
background: transparent; | ||
border-radius: 12px; | ||
font-family: Poppins; | ||
font-size: 14px; | ||
font-weight: 400; | ||
opacity: 1; | ||
letter-spacing: 0.5px; | ||
transition: border-color 0.3s ease; | ||
} | ||
|
||
.input::placeholder { | ||
color: #9e9ea7; | ||
opacity: 1; | ||
font-family: Poppins; | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 24px; | ||
text-align: left; | ||
} | ||
|
||
.input:focus { | ||
outline: none; | ||
border-color: #2d79f3; | ||
} | ||
|
||
.inputField:hover { | ||
border-color: #2d79f3; | ||
} | ||
|
||
.input:focus-within { | ||
border: 1px solid #2d79f3; | ||
} | ||
|
||
/* .visible { | ||
display: block; | ||
width: calc(100% - 20px); | ||
} */ | ||
|
||
@media (max-width: 800px) { | ||
/* .input { | ||
display: none; | ||
} */ | ||
|
||
/* .visible { | ||
display: block; | ||
width: calc(100% - 20px); | ||
} */ | ||
|
||
.searchIcon { | ||
display: block; | ||
} | ||
} |
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