chore: update search mode button description

This commit is contained in:
EnixCoda 2021-12-25 12:38:17 +08:00
parent 62d0187ac3
commit 54c002822d

View file

@ -15,6 +15,12 @@ export function SearchBar({ onSearch, onFocus, value }: Props) {
const configs = useConfigs()
const { searchMode } = configs.value
const toggleButtonDescription = `${
searchMode === 'regex'
? 'Match file name with regular expression.'
: 'Match file path sequence with input.'
} Click to toggle.`
return (
<div className={'search-input-wrapper'}>
<TextInput
@ -36,7 +42,7 @@ export function SearchBar({ onSearch, onFocus, value }: Props) {
<div className={`actions`}>
<button
className={`toggle-search-mode`}
title="Toggle search mode"
title={toggleButtonDescription}
onClick={() => {
const newMode = searchMode === 'regex' ? 'fuzzy' : 'regex'
configs.onChange({
@ -44,7 +50,7 @@ export function SearchBar({ onSearch, onFocus, value }: Props) {
})
onSearch(value, newMode)
}}
aria-label="Toggle search mode"
aria-label={toggleButtonDescription}
>
{searchMode === 'regex' ? '.*' : 'path'}
</button>