From f0c8cf0e79f003514fd65a70def5820205955a77 Mon Sep 17 00:00:00 2001
From: Noah Loomans <noahloomans@gmail.com>
Date: Thu, 21 Dec 2017 12:06:41 +0100
Subject: Move to typescript

---
 src/client/react/components/container/Results.tsx | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 src/client/react/components/container/Results.tsx

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

diff --git a/src/client/react/components/container/Results.tsx b/src/client/react/components/container/Results.tsx
new file mode 100644
index 0000000..21d3378
--- /dev/null
+++ b/src/client/react/components/container/Results.tsx
@@ -0,0 +1,26 @@
+import * as React from 'react';
+import { connect } from 'react-redux';
+import * as classnames from 'classnames';
+import Result from '../presentational/Result';
+import { User } from '../../users';
+import { State } from '../../reducers';
+
+const Results: React.StatelessComponent<{ results: string[], isExactMatch: boolean, selectedResult: string }> = (props) => (
+  <div
+    className={classnames('search__results', {
+      'search__results--has-results': !props.isExactMatch && props.results.length > 0,
+    })}
+  >
+    {!props.isExactMatch && props.results.map(userId => (
+      <Result key={userId} userId={userId} isSelected={userId === props.selectedResult} />
+    ))}
+  </div>
+);
+
+const mapStateToProps = (state: State) => ({
+  results: state.search.results,
+  isExactMatch: state.search.isExactMatch,
+  selectedResult: state.search.selectedResult,
+});
+
+export default connect(mapStateToProps)(Results);
-- 
cgit v1.1

