From 57393cc3810c88662ee0cc869b34632ce55e067e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tao=20Bror=20Bojl=C3=A9n?= Date: Sat, 3 Aug 2019 21:44:08 +0300 Subject: [PATCH] add search button to search bar --- CHANGELOG.md | 2 + .../src/components/screens/SearchScreen.tsx | 68 ++++++++++++------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1229543..c13b70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- You can now click a button in the search bar to search (you can also still just prss enter, of course). + ### Changed ### Deprecated diff --git a/frontend/src/components/screens/SearchScreen.tsx b/frontend/src/components/screens/SearchScreen.tsx index 2876a72..6addd17 100644 --- a/frontend/src/components/screens/SearchScreen.tsx +++ b/frontend/src/components/screens/SearchScreen.tsx @@ -1,4 +1,4 @@ -import { Button, Callout, Classes, H2, Intent, NonIdealState, Spinner } from "@blueprintjs/core"; +import { Button, Callout, H2, InputGroup, Intent, NonIdealState, Spinner } from "@blueprintjs/core"; import { IconNames } from "@blueprintjs/icons"; import { push } from "connected-react-router"; import React from "react"; @@ -60,24 +60,19 @@ class SearchScreen extends React.PureComponent; + content = ; } else if (!isLoadingResults && query && results.length === 0) { - return ( + content = ( ); - } - - return ( - - {isSmallScreen && results.length === 0 && this.renderMobileWarning()} -

Find an instance

- {this.renderSearchBar()} + } else if (!!results && results.length > 0) { + content = ( {results.map(result => ( )} + ); + } + + let rightSearchBarElement; + if (isLoadingResults) { + rightSearchBarElement = ; + } else if (query) { + rightSearchBarElement =