Search functionality

This commit is contained in:
Belen Curcio
2020-10-12 11:10:20 -03:00
parent aa8e8fe89d
commit 2a087905a7
2 changed files with 11 additions and 4 deletions

View File

@@ -19,10 +19,15 @@ const Searchbar: FC<Props> = ({ className }) => {
<input
className={s.input}
placeholder="Search for products..."
onChange={(e) => {
onKeyUp={(e) => {
e.preventDefault()
router.push('/search')
console.log('changing')
if (e.key === 'Enter') {
router.push({
pathname: `/search`,
query: { q: e.currentTarget.value },
})
}
}}
/>
<div className={s.iconContainer}>