diff --git a/src/components/modals/main/settings/sections/Search.jsx b/src/components/modals/main/settings/sections/Search.jsx index 21762f76..109db731 100644 --- a/src/components/modals/main/settings/sections/Search.jsx +++ b/src/components/modals/main/settings/sections/Search.jsx @@ -78,6 +78,7 @@ export default class SearchSettings extends PureComponent { {(navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined') ? : null} + this.setSearchEngine(value)}> {searchEngines.map((engine) => ( diff --git a/src/components/widgets/search/Search.jsx b/src/components/widgets/search/Search.jsx index 1b11b6ae..688b1f67 100644 --- a/src/components/widgets/search/Search.jsx +++ b/src/components/widgets/search/Search.jsx @@ -21,7 +21,8 @@ export default class Search extends PureComponent { autocompleteQuery: '', autocompleteCallback: '', microphone: null, - suggestions: [] + suggestions: [], + searchDropdown: 'none' }; this.language = window.language.widgets.search; } @@ -112,7 +113,40 @@ export default class Search extends PureComponent { autocompleteURL: autocompleteURL, autocompleteQuery: autocompleteQuery, autocompleteCallback: autocompleteCallback, - microphone: microphone + microphone: microphone, + currentSearch: info.name + }); + } + + toggleDropdown() { + if (this.state.searchDropdown === 'none') { + this.setState({ + searchDropdown: 'block' + }); + } else { + this.setState({ + searchDropdown: 'none' + }); + } + } + + setSearch(name) { + let url; + let query = 'q'; + const info = searchEngines.find((i) => i.name === name); + + if (info !== undefined) { + url = info.url; + if (info.query) { + query = info.query; + } + } + + this.setState({ + url: url, + query: query, + currentSearch: name, + searchDropdown: 'none' }); } @@ -133,6 +167,23 @@ export default class Search extends PureComponent { render() { return (
+ {localStorage.getItem('searchDropdown') === 'true' ? +
+ this.toggleDropdown()}>{this.state.currentSearch} +
+ {searchEngines.map((engine) => { + if (engine.name === this.state.currentSearch) { + return null; + } + return ( + <> + this.setSearch(engine.name)}>{engine.name} +
+ + ); + })} +
+
: null} {this.state.microphone} this.getSuggestions(e)} onClick={this.searchButton}/> diff --git a/src/components/widgets/search/search.scss b/src/components/widgets/search/search.scss index 4f33617d..d9844a92 100644 --- a/src/components/widgets/search/search.scss +++ b/src/components/widgets/search/search.scss @@ -49,6 +49,15 @@ } } +.searchDropdown { + display: inline-block; + font-size: calc(5px + 1.2vmin); + + .searchSelected { + cursor: pointer; + } +} + .micIcon { margin-right: 10px; position: relative !important; diff --git a/src/translations/de_DE.json b/src/translations/de_DE.json index a061a965..fb59192a 100644 --- a/src/translations/de_DE.json +++ b/src/translations/de_DE.json @@ -193,7 +193,8 @@ "custom": "Abfrage-URL", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Sprachsuche" + "voice_search": "Sprachsuche", + "dropdown": "Search dropdown" }, "weather": { "title": "Wetter", diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index 26c04b06..a0827b98 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -193,7 +193,8 @@ "custom": "Custom search URL", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Voice search" + "voice_search": "Voice search", + "dropdown": "Search dropdown" }, "weather": { "title": "Weather", diff --git a/src/translations/en_US.json b/src/translations/en_US.json index 80fdae2c..7f59a534 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -193,7 +193,8 @@ "custom": "Custom search URL", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Voice search" + "voice_search": "Voice search", + "dropdown": "Search dropdown" }, "weather": { "title": "Weather", diff --git a/src/translations/es.json b/src/translations/es.json index f9ead658..3a7a81e1 100644 --- a/src/translations/es.json +++ b/src/translations/es.json @@ -193,7 +193,8 @@ "custom": "URL de búsqueda personalizada", "autocomplete": "Autocompletado", "autocomplete_provider": "Proveedor del autocompletado", - "voice_search": "Búsqueda por voz" + "voice_search": "Búsqueda por voz", + "dropdown": "Search dropdown" }, "weather": { "title": "Clima", diff --git a/src/translations/fr.json b/src/translations/fr.json index 347efe43..ccdc6a82 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -193,7 +193,8 @@ "custom": "URL de recherche personnalisée", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Recherche vocale" + "voice_search": "Recherche vocale", + "dropdown": "Search dropdown" }, "weather": { "title": "Météo", diff --git a/src/translations/nl.json b/src/translations/nl.json index 4299bbff..28cfe415 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -193,7 +193,8 @@ "custom": "Aangepaste zoekmachine-url", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Spraakgestuurd zoeken gebruiken" + "voice_search": "Spraakgestuurd zoeken gebruiken", + "dropdown": "Search dropdown" }, "weather": { "title": "Weather", diff --git a/src/translations/no.json b/src/translations/no.json index a7208122..02d7b440 100644 --- a/src/translations/no.json +++ b/src/translations/no.json @@ -193,7 +193,8 @@ "custom": "Custom search URL", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Voice search" + "voice_search": "Voice search", + "dropdown": "Search dropdown" }, "weather": { "title": "Weather", diff --git a/src/translations/ru.json b/src/translations/ru.json index 7d8febe2..98929c1b 100644 --- a/src/translations/ru.json +++ b/src/translations/ru.json @@ -193,7 +193,8 @@ "custom": "Пользовательский поисковый движок", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "Поиск голосом" + "voice_search": "Поиск голосом", + "dropdown": "Search dropdown" }, "weather": { "title": "Weather", diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json index 16ebc34c..f0320903 100644 --- a/src/translations/zh_CN.json +++ b/src/translations/zh_CN.json @@ -193,7 +193,8 @@ "custom": "自定义搜索链接", "autocomplete": "Autocomplete", "autocomplete_provider": "Autocomplete Provider", - "voice_search": "语音搜索" + "voice_search": "语音搜索", + "dropdown": "Search dropdown" }, "weather": { "title": "天气",