You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

  1. import React from 'react';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import PropTypes from 'prop-types';
  4. import StatusContainer from '../containers/status_container';
  5. import ImmutablePureComponent from 'react-immutable-pure-component';
  6. import ScrollableList from './scrollable_list';
  7. export default class StatusList extends ImmutablePureComponent {
  8. static propTypes = {
  9. scrollKey: PropTypes.string.isRequired,
  10. statusIds: ImmutablePropTypes.list.isRequired,
  11. onScrollToBottom: PropTypes.func,
  12. onScrollToTop: PropTypes.func,
  13. onScroll: PropTypes.func,
  14. trackScroll: PropTypes.bool,
  15. shouldUpdateScroll: PropTypes.func,
  16. isLoading: PropTypes.bool,
  17. hasMore: PropTypes.bool,
  18. prepend: PropTypes.node,
  19. emptyMessage: PropTypes.node,
  20. };
  21. static defaultProps = {
  22. trackScroll: true,
  23. };
  24. render () {
  25. const { statusIds, ...other } = this.props;
  26. const { isLoading } = other;
  27. const scrollableContent = (isLoading || statusIds.size > 0) ? (
  28. statusIds.map((statusId) => (
  29. <StatusContainer key={statusId} id={statusId} />
  30. ))
  31. ) : null;
  32. return (
  33. <ScrollableList {...other}>
  34. {scrollableContent}
  35. </ScrollableList>
  36. );
  37. }
  38. }