From 315adeb5e2012b7f7bcfcd1478f9d6dd2cc1092d Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 26 Jun 2018 21:46:41 +0200 Subject: Update code to comply with new styling --- src/client/react/components/container/Results.js | 29 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/client/react/components/container/Results.js') diff --git a/src/client/react/components/container/Results.js b/src/client/react/components/container/Results.js index 82e37cb..314bbca 100644 --- a/src/client/react/components/container/Results.js +++ b/src/client/react/components/container/Results.js @@ -50,34 +50,43 @@ class Results extends React.Component { }; render() { - const user = userFromMatch(this.props.match); + const { + searchText, + results, + selectedResult, + match, + location, + history, + dispatch, + } = this.props; + const user = userFromMatch(match); - const isExactMatch = - user != null && - this.props.searchText === users.byId[user].value; + const isExactMatch = ( + user != null && searchText === users.byId[user].value + ); return (
0, + hasResults: !isExactMatch && results.length > 0, })} style={{ - minHeight: isExactMatch ? 0 : this.props.results.length * 54, + minHeight: isExactMatch ? 0 : results.length * 54, }} > - {!isExactMatch && this.props.results.map(userId => ( + {!isExactMatch && results.map(userId => ( { if (userId === user) { // EDGE CASE: The user is set if the user changes, but it doesn't // change if the result is already the one we are viewing. // Therefor, we need to dispatch the SET_USER command manually. - this.props.dispatch({ type: 'SEARCH/SET_USER', user }); + dispatch({ type: 'SEARCH/SET_USER', user }); } else { - setUser(userId, this.props.location, this.props.history); + setUser(userId, location, history); } }} /> -- cgit v1.1