import React, { FormEventHandler, RefObject } from 'react'; import { Box, Text, Input, Icon, Icons, Spinner, Chip, config } from 'folds'; type SearchProps = { active?: boolean; loading?: boolean; searchInputRef: RefObject; onSearch: (term: string) => void; onReset: () => void; }; export function SearchInput({ active, loading, searchInputRef, onSearch, onReset }: SearchProps) { const handleSearchSubmit: FormEventHandler = (evt) => { evt.preventDefault(); const { searchInput } = evt.target as HTMLFormElement & { searchInput: HTMLInputElement; }; const searchTerm = searchInput.value.trim() || undefined; if (searchTerm) { onSearch(searchTerm); } }; return ( Search ) : ( ) } after={ active ? ( } onClick={onReset} > Clear ) : ( Enter ) } /> ); }