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

39 lines
859 B
JavaScript
Raw Normal View History

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'
export default class List extends PureComponent {
static propTypes = {
items: PropTypes.array,
scrollKey: PropTypes.string,
emptyMessage: PropTypes.any,
}
render() {
const { items, scrollKey, emptyMessage } = this.props
return (
2020-02-22 23:26:23 +00:00
<Block>
2020-02-21 00:57:29 +00:00
<ScrollableList
scrollKey={scrollKey}
emptyMessage={emptyMessage}
>
{
items.map((item, i) => {
return (
<ListItem
key={`list-item-${i}`}
to={item.to}
title={item.title}
isLast={items.length - 1 === i}
/>
)
})
}
</ScrollableList>
2020-02-22 23:26:23 +00:00
</Block>
2020-02-21 00:57:29 +00:00
)
}
}