35c5608e1a
• Updated: - HomePage sidebar panels (WhoToFollowPanel, ListsPanel, GroupsPanel) to lazy load on scroll of 25px. Otherwise, dont load. - WhoToFollowPanel, ListsPanel, GroupsPanel have functionality to load data once • Added: - List component has showLoading prop • Removed: - Unused IntersectionObserver code in HomePage
64 lines
1.4 KiB
JavaScript
64 lines
1.4 KiB
JavaScript
import ImmutablePureComponent from 'react-immutable-pure-component'
|
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
|
import Block from './block'
|
|
import ScrollableList from './scrollable_list'
|
|
import ListItem from './list_item'
|
|
import Dummy from './dummy'
|
|
|
|
export default class List extends ImmutablePureComponent {
|
|
|
|
static propTypes = {
|
|
items: PropTypes.oneOfType([
|
|
PropTypes.array,
|
|
ImmutablePropTypes.map,
|
|
ImmutablePropTypes.list,
|
|
]),
|
|
scrollKey: PropTypes.string,
|
|
emptyMessage: PropTypes.any,
|
|
size: PropTypes.oneOf([
|
|
'small',
|
|
'large'
|
|
]),
|
|
onLoadMore: PropTypes.func,
|
|
hasMore: PropTypes.bool,
|
|
showLoading: PropTypes.bool,
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
items,
|
|
scrollKey,
|
|
emptyMessage,
|
|
hasMore,
|
|
size,
|
|
onLoadMore,
|
|
showLoading,
|
|
} = this.props
|
|
|
|
const Wrapper = !!scrollKey ? ScrollableList : Dummy
|
|
|
|
return (
|
|
<Block>
|
|
<Wrapper
|
|
onLoadMore={onLoadMore}
|
|
hasMore={hasMore}
|
|
scrollKey={scrollKey}
|
|
emptyMessage={emptyMessage}
|
|
showLoading={showLoading}
|
|
>
|
|
{
|
|
items.map((item, i) => (
|
|
<ListItem
|
|
size={size}
|
|
key={`list-item-${i}`}
|
|
isLast={items.size - 1 === i}
|
|
{...item}
|
|
/>
|
|
))
|
|
}
|
|
</Wrapper>
|
|
</Block>
|
|
)
|
|
}
|
|
|
|
} |