diff --git a/src/components/views/elements/TruncatedList.js b/src/components/views/elements/TruncatedList.js index e49c296515..3e174848d3 100644 --- a/src/components/views/elements/TruncatedList.js +++ b/src/components/views/elements/TruncatedList.js @@ -28,16 +28,10 @@ module.exports = React.createClass({ createOverflowElement: React.PropTypes.func }, - getInitialState: function() { - return { - enabled: true, - }; - }, - getDefaultProps: function() { return { truncateAt: 2, - createOverflowElement: function(overflowCount, totalCount, toggleTruncate, isExpanded) { + createOverflowElement: function(overflowCount, totalCount) { return (
And {overflowCount} more...
); @@ -45,12 +39,6 @@ module.exports = React.createClass({ }; }, - toggleTruncate: function() { - this.setState({ - enabled: !this.state.enabled - }); - }, - render: function() { var childsJsx = this.props.children; var overflowJsx; @@ -60,26 +48,20 @@ module.exports = React.createClass({ var childCount = childArray.length; - if (this.state.enabled && this.props.truncateAt >= 0) { + if (this.props.truncateAt >= 0) { var overflowCount = childCount - this.props.truncateAt; if (overflowCount > 1) { overflowJsx = this.props.createOverflowElement( - overflowCount, childCount, this.toggleTruncate + overflowCount, childCount ); - + // cut out the overflow elements childArray.splice(childCount - overflowCount, overflowCount); childsJsx = childArray; // use what is left } } - if (!this.state.enabled) { - overflowJsx = this.props.createOverflowElement( - 0, childCount, this.toggleTruncate, true - ); - } - return (
{childsJsx}