From 778dfdc728a101fca9ece3a14e590d3b8e1d43e1 Mon Sep 17 00:00:00 2001
From: Noah Loomans <noahloomans@gmail.com>
Date: Thu, 14 Dec 2017 12:32:07 +0100
Subject: Use id's instead of user objects

---
 src/client/react/components/container/Results.jsx | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

(limited to 'src/client/react/components/container/Results.jsx')

diff --git a/src/client/react/components/container/Results.jsx b/src/client/react/components/container/Results.jsx
index 9be2639..911ea27 100644
--- a/src/client/react/components/container/Results.jsx
+++ b/src/client/react/components/container/Results.jsx
@@ -4,27 +4,22 @@ import { connect } from 'react-redux';
 import classnames from 'classnames';
 import Result from '../presentational/Result';
 
-const Results = (({ results, selectedResult }) => (
+const Results = (({ results, isExactMatch, selectedResult }) => (
   <div
     className={classnames('search__results', {
-      'search__results--has-results': results.length > 0,
+      'search__results--has-results': !isExactMatch && results.length > 0,
     })}
   >
-    {results.map(user => (
-      <Result key={user.value} user={user} selected={user === selectedResult} />
+    {!isExactMatch && results.map(userId => (
+      <Result key={userId} userId={userId} isSelected={userId === selectedResult} />
     ))}
   </div>
 ));
 
 Results.propTypes = {
-  results: PropTypes.arrayOf(PropTypes.shape({
-    type: PropTypes.string,
-    value: PropTypes.string,
-  })).isRequired,
-  selectedResult: PropTypes.shape({
-    type: PropTypes.string,
-    value: PropTypes.string,
-  }),
+  results: PropTypes.arrayOf(PropTypes.string).isRequired,
+  isExactMatch: PropTypes.bool.isRequired,
+  selectedResult: PropTypes.string,
 };
 
 Results.defaultProps = {
@@ -33,6 +28,7 @@ Results.defaultProps = {
 
 const mapStateToProps = state => ({
   results: state.search.results,
+  isExactMatch: state.search.isExactMatch,
   selectedResult: state.search.selectedResult,
 });
 
-- 
cgit v1.1

