const debounce = require('lodash.debounce'); const ReactRedux = require('react-redux'); const Infinite = require('react-infinite'); const actions = require('./actions'); const React = require('react'); const { connect } = ReactRedux; const { fetch, filter } = actions; const mapStateToProps = (state) => { return state; }; const mapDispatchToProps = (dispatch, ownProps) => { return { fetch: () => { return dispatch(fetch()); }, filter: (payload) => { return dispatch(filter(payload)); } } }; const styles = { item: { borderRadius: '4px', backgroundColor: '#ffffff', boxShadow: '0 2px 0 0 rgba(0, 0, 0, 0.05)', border: 'solid 1px #d8d8d8', marginBottom: '20px', padding: '20px', clear: 'both' }, itemImage: { width: '25%', float: 'left', width: '150px', height: '150px' }, itemText: { float: 'right', paddingLeft: '20px' } } const List = ({ items = [], filtered, input = '', fetching = false, fetch, filter }) => { const _items = (filtered || items).map((item) => { const fill = Math.random() > 0.5 ? 'red' : 'green'; const status = Math.random() > 0.5 ? 'Unhealthy' : 'Healthy'; return (
{item.title}

{item.title}

{status}

{item.description}

); }); const _loading = (
Loading...
); const _filter = debounce(filter, 100); const onChange = (ev) => _filter(ev.target.value); return (
{_items}
); }; module.exports = connect( mapStateToProps, mapDispatchToProps, )(List);