From ebb14ffc54670c8e2cbeba18eac238965eee4e81 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 6 Jul 2018 16:14:30 +0200 Subject: client: Simplify setUser --- src/client/react/components/presentational/Results.js | 13 +++++++------ src/client/react/components/presentational/Search.js | 11 ++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/client/react/components/presentational') diff --git a/src/client/react/components/presentational/Results.js b/src/client/react/components/presentational/Results.js index 173c644..4abd507 100644 --- a/src/client/react/components/presentational/Results.js +++ b/src/client/react/components/presentational/Results.js @@ -27,34 +27,35 @@ import './Results.scss'; class Results extends React.Component { static propTypes = { - results: PropTypes.arrayOf(PropTypes.string).isRequired, + results: PropTypes.arrayOf(PropTypes.string), selectedResult: PropTypes.string, - isExactMatch: PropTypes.bool.isRequired, setUser: PropTypes.func.isRequired, }; static defaultProps = { selectedResult: null, + results: [], }; render() { const { results, selectedResult, - isExactMatch, setUser, } = this.props; + const hasResults = results.length > 0; + return (
0, + hasResults, })} style={{ - minHeight: isExactMatch ? 0 : results.length * 54, + minHeight: hasResults ? results.length * 54 : 0, }} > - {!isExactMatch && results.map(userId => ( + {results.map(userId => (
} />
onInputChange(event.target.value)} + onChange={event => changeInput(event.target.value)} onKeyDown={event => this.handleKeyDown(event)} value={searchText} placeholder="Zoeken" -- cgit v1.1