gab-social/app/javascript/gabsocial/components/list.js

39 lines
907 B
JavaScript
Raw Normal View History

2020-03-25 03:08:43 +00:00
import ImmutablePureComponent from 'react-immutable-pure-component'
2020-02-22 23:26:23 +00:00
import Block from './block'
2020-02-21 00:57:29 +00:00
import ScrollableList from './scrollable_list'
import ListItem from './list_item'
2020-03-25 03:08:43 +00:00
export default class List extends ImmutablePureComponent {
2020-02-21 00:57:29 +00:00
static propTypes = {
items: PropTypes.array,
scrollKey: PropTypes.string,
emptyMessage: PropTypes.any,
2020-03-14 17:31:29 +00:00
small: PropTypes.bool,
2020-02-21 00:57:29 +00:00
}
render() {
2020-03-14 17:31:29 +00:00
const { items, scrollKey, emptyMessage, small } = this.props
2020-02-21 00:57:29 +00:00
return (
2020-02-22 23:26:23 +00:00
<Block>
2020-02-21 00:57:29 +00:00
<ScrollableList
scrollKey={scrollKey}
emptyMessage={emptyMessage}
>
{
2020-03-25 03:08:43 +00:00
items.map((item, i) => (
<ListItem
small={small}
key={`list-item-${i}`}
isLast={items.size - 1 === i}
{...item}
/>
))
2020-02-21 00:57:29 +00:00
}
</ScrollableList>
2020-03-14 17:31:29 +00:00
</Block>
2020-02-21 00:57:29 +00:00
)
}
}