diff options
Diffstat (limited to 'src/client/react/components/container/Search.js')
-rw-r--r-- | src/client/react/components/container/Search.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/react/components/container/Search.js b/src/client/react/components/container/Search.js index b42699f..32996e3 100644 --- a/src/client/react/components/container/Search.js +++ b/src/client/react/components/container/Search.js @@ -82,9 +82,8 @@ class Search extends React.Component { render() { const { - selectedResult, - isExactMatch, searchText, + match, dispatch, } = this.props; @@ -92,13 +91,19 @@ class Search extends React.Component { hasFocus, } = this.state; + const urlUser = userFromMatch(match); + + const isExactMatch = + urlUser != null && + searchText === users.byId[urlUser].value; + return ( <div className="search"> <div className={classnames('search-overflow', { 'search--has-focus': hasFocus })}> <div className="search__input-wrapper"> <div className="search__icon-wrapper"> <IconFromUserType - userType={isExactMatch ? users.byId[selectedResult].type : null} + userType={isExactMatch ? users.byId[urlUser].type : null} defaultIcon={<SearchIcon />} /> </div> @@ -123,7 +128,6 @@ class Search extends React.Component { Search.propTypes = { results: PropTypes.arrayOf(PropTypes.string).isRequired, selectedResult: PropTypes.string, - isExactMatch: PropTypes.bool.isRequired, searchText: PropTypes.string.isRequired, // react-router |