huridocs/uwazi

View on GitHub
app/react/SemanticSearch/components/SearchList.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';

import { SearchItem } from './SearchItem';

const SearchListComponent = ({ searches }) => (
  <div className="semantic-search-list">
    {searches.map(search => (
      <SearchItem search={search} key={search._id} />
    ))}
  </div>
);

SearchListComponent.defaultProps = {
  searches: [],
};

SearchListComponent.propTypes = {
  searches: PropTypes.arrayOf(
    PropTypes.shape({
      _id: PropTypes.string,
      searchTerm: PropTypes.string,
      documents: PropTypes.array,
      status: PropTypes.string,
    })
  ),
};

export { SearchListComponent };
export default connect()(SearchListComponent);