aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/SearchForm/SearchForm.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-20 22:59:32 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-20 22:59:32 +0100
commit168ed3215f659d44215fd02ac05cc1fe58be4e06 (patch)
tree48d15a4743749f483f50f919ffa94e38185588a1 /src/components/SearchForm/SearchForm.tsx
parentb181f93f0f26570696d3a90b58a966c56ac61047 (diff)
chore: create search view
Diffstat (limited to 'src/components/SearchForm/SearchForm.tsx')
-rw-r--r--src/components/SearchForm/SearchForm.tsx4
1 files changed, 4 insertions, 0 deletions
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<HTMLInputElement>(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 (