blob: 1c38c8bd5d5a58bb6635a9187069394dab7c5935 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import classnames from 'classnames';
import Result from '../presentational/Result';
const Results = (({ results }) => (
<div
className={classnames('search__results', {
'search__results--has-results': results.length > 0,
})}
>
{results.map(user => (
<Result key={user.value} user={user} />
))}
</div>
));
Results.propTypes = {
results: PropTypes.arrayOf(PropTypes.shape({
type: PropTypes.string,
value: PropTypes.value,
})).isRequired,
};
const mapStateToProps = state => ({
results: state.search.results,
});
export default connect(mapStateToProps)(Results);
|