import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import Button from './button' import Comment from './comment' import Text from './text' export default class CommentList extends ImmutablePureComponent { static propTypes = { commentsLimited: PropTypes.bool, descendants: ImmutablePropTypes.list, } render() { const { descendants, commentsLimited, } = this.props const size = descendants.size const max = Math.min(commentsLimited ? 2 : 6, size) console.log("max:", size, max) return (
{ descendants.slice(0, max).map((descendant, i) => ( )) } { size > 0 && size > max &&
{max}  of  {size}
}
) } }