diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index f3fc148..0eba914 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -1,4 +1,4 @@ -import { SearchIcon } from '@primer/octicons-react' +import { SearchIcon, XIcon } from '@primer/octicons-react' import { TextInput, TextInputProps } from '@primer/react' import { useConfigs } from 'containers/ConfigsContext' import * as React from 'react' @@ -48,20 +48,26 @@ export function SearchBar({ onSearch, onFocus, value }: Props) { value={value} validationStatus={validationStatus} trailingAction={ - { - const newMode = searchMode === 'regex' ? 'fuzzy' : 'regex' - configs.onChange({ - searchMode: newMode, - }) - // Skip search if no input to prevent resetting folder expansions - if (value) onSearch(value, newMode) - }} - > - {searchMode === 'regex' ? '.*$' : 'a/b'} - + <> + onSearch('', searchMode)} + icon={XIcon} + aria-label="Clear" + /> + { + const newMode = searchMode === 'regex' ? 'fuzzy' : 'regex' + configs.onChange({ searchMode: newMode }) + // Skip search if no input to prevent resetting folder expansions + if (value) onSearch(value, newMode) + }} + > + {searchMode === 'regex' ? '.*$' : 'a/b'} + + } /> )