diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-12-14 12:32:07 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-12-14 12:32:07 +0100 |
commit | 778dfdc728a101fca9ece3a14e590d3b8e1d43e1 (patch) | |
tree | a1be824bacb17fc5cdc2e3e155d46db770a96b28 /src/client/react/components/presentational | |
parent | 503ab5c66ab524dfe36aed84a01899cd07ed2bc5 (diff) |
Use id's instead of user objects
Diffstat (limited to 'src/client/react/components/presentational')
-rw-r--r-- | src/client/react/components/presentational/Result.jsx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/client/react/components/presentational/Result.jsx b/src/client/react/components/presentational/Result.jsx index 80f65d4..0b9e024 100644 --- a/src/client/react/components/presentational/Result.jsx +++ b/src/client/react/components/presentational/Result.jsx @@ -1,26 +1,24 @@ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; +import users from '../../users'; import IconFromUserType from './IconFromUserType'; -const Result = ({ user, selected }) => ( +const Result = ({ userId, isSelected }) => ( <div className={classnames('search__result', { - 'search__result--selected': selected, + 'search__result--selected': isSelected, })} > - <div className="search__icon-wrapper"><IconFromUserType userType={user.type} /></div> - <div className="search__result__text">{user.value}</div> + <div className="search__icon-wrapper"><IconFromUserType userType={users.byId[userId].type} /></div> + <div className="search__result__text">{users.byId[userId].value}</div> </div> ); Result.propTypes = { - user: PropTypes.shape({ - value: PropTypes.string.isRequired, - type: PropTypes.string.isRequired, - }).isRequired, - selected: PropTypes.bool.isRequired, + userId: PropTypes.string.isRequired, + isSelected: PropTypes.bool.isRequired, }; export default Result; |