diff --git a/examples/catalog/components/search/Form.tsx b/examples/catalog/components/search/Form.tsx index 27113f55..68bc9c87 100644 --- a/examples/catalog/components/search/Form.tsx +++ b/examples/catalog/components/search/Form.tsx @@ -1,19 +1,41 @@ +import { useState } from 'react'; import { useRouter } from 'next/router'; -import { Form } from 'portal'; const SearchForm: React.FC = () => { const router = useRouter(); + const [searchQuery, setSearchQuery] = useState(''); - const handleSubmit = (q) => { + const handleSubmit = (e) => { + if (e) { + e.preventDefault(); + } router.push({ pathname: '/search', - query: { q }, + query: { q: searchQuery }, }); }; + return ( - <> -
- > + ); };