Germinal commited on
Commit
40aa7cc
·
verified ·
1 Parent(s): 094ec29

Upload components/SearchForm.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/SearchForm.jsx +63 -0
components/SearchForm.jsx ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react';
2
+ import { FiSearch } from 'react-icons/fi';
3
+
4
+ export default function SearchForm({ onSearch }) {
5
+ const [query, setQuery] = useState('');
6
+ const [locationType, setLocationType] = useState('municipio');
7
+
8
+ const handleSubmit = (e) => {
9
+ e.preventDefault();
10
+ if (query.trim()) {
11
+ onSearch({ query, locationType });
12
+ }
13
+ };
14
+
15
+ return (
16
+ <div className="bg-white rounded-lg shadow-md p-6 mb-8">
17
+ <form onSubmit={handleSubmit} className="space-y-4">
18
+ <div>
19
+ <label htmlFor="locationType" className="block text-sm font-medium text-gray-700 mb-1">
20
+ Tipo de Localização
21
+ </label>
22
+ <select
23
+ id="locationType"
24
+ value={locationType}
25
+ onChange={(e) => setLocationType(e.target.value)}
26
+ className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary"
27
+ >
28
+ <option value="municipio">Município</option>
29
+ <option value="cidade">Cidade</option>
30
+ <option value="estado">Estado</option>
31
+ </select>
32
+ </div>
33
+
34
+ <div>
35
+ <label htmlFor="query" className="block text-sm font-medium text-gray-700 mb-1">
36
+ Nome da Localização
37
+ </label>
38
+ <div className="relative">
39
+ <input
40
+ type="text"
41
+ id="query"
42
+ value={query}
43
+ onChange={(e) => setQuery(e.target.value)}
44
+ placeholder={`Digite o nome do ${locationType}`}
45
+ className="w-full px-4 py-2 pl-10 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary"
46
+ required
47
+ />
48
+ <div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
49
+ <FiSearch className="h-5 w-5 text-gray-400" />
50
+ </div>
51
+ </div>
52
+ </div>
53
+
54
+ <button
55
+ type="submit"
56
+ className="w-full bg-primary hover:bg-secondary text-white font-medium py-2 px-4 rounded-md transition duration-200"
57
+ >
58
+ Pesquisar Agentes Públicos
59
+ </button>
60
+ </form>
61
+ </div>
62
+ );
63
+ }