({ onTextFilter, onSearch, initialText })
| 44 | } |
| 45 | |
| 46 | export function SearchFormSection ({ onTextFilter, onSearch, initialText }) { |
| 47 | const idText = useId() |
| 48 | const idTechnology = useId() |
| 49 | const idLocation = useId() |
| 50 | const idExperienceLevel = useId() |
| 51 | |
| 52 | const inputRef = useRef() |
| 53 | |
| 54 | const { |
| 55 | handleSubmit, |
| 56 | handleTextChange |
| 57 | } = useSearchForm({ idTechnology, idLocation, idExperienceLevel, idText, onSearch, onTextFilter }) |
| 58 | |
| 59 | const handleClearInput = (event) => { |
| 60 | event.preventDefault() |
| 61 | |
| 62 | inputRef.current.value = "" |
| 63 | onTextFilter("") |
| 64 | } |
| 65 | |
| 66 | return ( |
| 67 | <section className="jobs-search"> |
| 68 | <h1>Encuentra tu próximo trabajo</h1> |
| 69 | <p>Explora miles de oportunidades en el sector tecnológico.</p> |
| 70 | |
| 71 | <form onChange={handleSubmit} id="empleos-search-form" role="search"> |
| 72 | |
| 73 | <div className="search-bar"> |
| 74 | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" |
| 75 | stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round" |
| 76 | className="icon icon-tabler icons-tabler-outline icon-tabler-search"> |
| 77 | <path stroke="none" d="M0 0h24v24H0z" fill="none" /> |
| 78 | <path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" /> |
| 79 | <path d="M21 21l-6 -6" /> |
| 80 | </svg> |
| 81 | |
| 82 | <input |
| 83 | ref={inputRef} |
| 84 | name={idText} id="empleos-search-input" type="text" |
| 85 | placeholder="Buscar trabajos, empresas o habilidades" |
| 86 | onChange={handleTextChange} |
| 87 | defaultValue={initialText} |
| 88 | /> |
| 89 | |
| 90 | <button onClick={handleClearInput}> |
| 91 | ✖︎ |
| 92 | </button> |
| 93 | </div> |
| 94 | |
| 95 | <div className="search-filters"> |
| 96 | <select name={idTechnology} id="filter-technology"> |
| 97 | <option value="">Tecnología</option> |
| 98 | <optgroup label="Tecnologías populares"> |
| 99 | <option value="javascript">JavaScript</option> |
| 100 | <option value="python">Python</option> |
| 101 | <option value="react">React</option> |
| 102 | <option value="nodejs">Node.js</option> |
| 103 | </optgroup> |
nothing calls this directly
no test coverage detected