aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-04-29 22:46:26 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-04-29 22:46:26 -0500
commit9ab5999103b59976f0ad580b6ec849f961a91f68 (patch)
tree32c2765041d9162e07061b65e3d320b1fa223acb /src
parentf2b11298df5f2523168ad65613d5f93206b315f4 (diff)
downloadslskd-9ab5999103b59976f0ad580b6ec849f961a91f68.tar.gz
add button for background search
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/Search/Search.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/web/src/components/Search/Search.js b/src/web/src/components/Search/Search.js
index 5704c3c0..887937b3 100644
--- a/src/web/src/components/Search/Search.js
+++ b/src/web/src/components/Search/Search.js
@@ -59,6 +59,14 @@ class Search extends Component {
});
}
+ backgroundSearch = async () => {
+ const searchPhrase = this.inputtext.inputRef.current.value;
+ const searchId = uuidv4();
+ await searches.create({ id: searchId, searchText: searchPhrase });
+ this.setSearchText();
+ this.inputtext.focus();
+ }
+
clear = () => {
this.setState(initialState, () => {
this.saveState();
@@ -217,7 +225,11 @@ class Search extends Component {
disabled={pending}
className='search-input'
placeholder="Search phrase"
- action={!pending && (searchState === 'idle' ? { icon: 'search', onClick: this.search } : { icon: 'x', color: 'red', onClick: this.clear })}
+ action={!pending && (searchState === 'idle' ?
+ <>
+ <Button icon='plus' onClick={this.backgroundSearch} />
+ <Button icon='search' onClick={this.search} />
+ </> : <Button icon='x' color='red' onClick={this.clear} />)}
onKeyUp={(e) => e.key === 'Enter' ? this.search() : ''}
/>
</Segment>