Home Reference Source

application/components/search/result-table.js

import React, { Component } from 'react';
import {connect} from 'react-redux';
import {Row, Col} from '../flexbox';

import {ContentRow} from '../content/content-table';

class SearchResultsTable extends Component {
    render() {
        if (!this.props.globalSearch.items.size) {
            return (
                <div>
                    <p className='clear-top'>
                        Sorry, no items found.
                    </p>
                </div>
            );
        }

        return (
            <div>
                {this.props.globalSearch.items.map((item, i) => <ContentRow key={i} item={item} />)}
            </div>
        );
    }
}

const mapStateToProps = (state) => {
    return {
        globalSearch: state.globalSearch
    }
};

export default connect(mapStateToProps)(SearchResultsTable);