From f0bdfadab7e5293b3f7855b6707a1fa95ea76ca6 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Sun, 13 Nov 2016 13:04:18 +0100
Subject: Search component

---
 .../compose/containers/search_container.jsx        | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 app/assets/javascripts/components/features/compose/containers/search_container.jsx

(limited to 'app/assets/javascripts/components/features/compose/containers/search_container.jsx')

diff --git a/app/assets/javascripts/components/features/compose/containers/search_container.jsx b/app/assets/javascripts/components/features/compose/containers/search_container.jsx
new file mode 100644
index 000000000..17a68f2fc
--- /dev/null
+++ b/app/assets/javascripts/components/features/compose/containers/search_container.jsx
@@ -0,0 +1,35 @@
+import { connect } from 'react-redux';
+import {
+  changeSearch,
+  clearSearchSuggestions,
+  fetchSearchSuggestions,
+  resetSearch
+} from '../../../actions/search';
+import Search from '../components/search';
+
+const mapStateToProps = state => ({
+  suggestions: state.getIn(['search', 'suggestions']),
+  value: state.getIn(['search', 'value'])
+});
+
+const mapDispatchToProps = dispatch => ({
+
+  onChange (value) {
+    dispatch(changeSearch(value));
+  },
+
+  onClear () {
+    dispatch(clearSearchSuggestions());
+  },
+
+  onFetch (value) {
+    dispatch(fetchSearchSuggestions(value));
+  },
+
+  onReset () {
+    dispatch(resetSearch());
+  }
+
+});
+
+export default connect(mapStateToProps, mapDispatchToProps)(Search);
-- 
cgit 

