From 168ed3215f659d44215fd02ac05cc1fe58be4e06 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 20 Dec 2021 22:59:32 +0100 Subject: chore: create search view --- src/components/SearchForm/SearchForm.tsx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/components/SearchForm') diff --git a/src/components/SearchForm/SearchForm.tsx b/src/components/SearchForm/SearchForm.tsx index c02c224..e37ba9e 100644 --- a/src/components/SearchForm/SearchForm.tsx +++ b/src/components/SearchForm/SearchForm.tsx @@ -1,11 +1,13 @@ import { ButtonSubmit } from '@components/Buttons'; import { Form, Input } from '@components/Form'; import { t } from '@lingui/macro'; +import { useRouter } from 'next/router'; import { FormEvent, useEffect, useRef, useState } from 'react'; const SearchForm = ({ isOpened }: { isOpened: boolean }) => { const [query, setQuery] = useState(''); const inputRef = useRef(null); + const router = useRouter(); useEffect(() => { setTimeout(() => { @@ -17,6 +19,8 @@ const SearchForm = ({ isOpened }: { isOpened: boolean }) => { const launchSearch = (e: FormEvent) => { e.preventDefault(); + router.push({ pathname: '/recherche', query: { s: query } }); + setQuery(''); }; return ( -- cgit v1.2.3