revert now redundant TruncatedList edits

This commit is contained in:
Luke Barnard 2016-11-10 15:51:27 +00:00
parent f71ac93946
commit ac460122cc

View file

@ -28,16 +28,10 @@ module.exports = React.createClass({
createOverflowElement: React.PropTypes.func createOverflowElement: React.PropTypes.func
}, },
getInitialState: function() {
return {
enabled: true,
};
},
getDefaultProps: function() { getDefaultProps: function() {
return { return {
truncateAt: 2, truncateAt: 2,
createOverflowElement: function(overflowCount, totalCount, toggleTruncate, isExpanded) { createOverflowElement: function(overflowCount, totalCount) {
return ( return (
<div>And {overflowCount} more...</div> <div>And {overflowCount} more...</div>
); );
@ -45,12 +39,6 @@ module.exports = React.createClass({
}; };
}, },
toggleTruncate: function() {
this.setState({
enabled: !this.state.enabled
});
},
render: function() { render: function() {
var childsJsx = this.props.children; var childsJsx = this.props.children;
var overflowJsx; var overflowJsx;
@ -60,12 +48,12 @@ module.exports = React.createClass({
var childCount = childArray.length; var childCount = childArray.length;
if (this.state.enabled && this.props.truncateAt >= 0) { if (this.props.truncateAt >= 0) {
var overflowCount = childCount - this.props.truncateAt; var overflowCount = childCount - this.props.truncateAt;
if (overflowCount > 1) { if (overflowCount > 1) {
overflowJsx = this.props.createOverflowElement( overflowJsx = this.props.createOverflowElement(
overflowCount, childCount, this.toggleTruncate overflowCount, childCount
); );
// cut out the overflow elements // cut out the overflow elements
@ -74,12 +62,6 @@ module.exports = React.createClass({
} }
} }
if (!this.state.enabled) {
overflowJsx = this.props.createOverflowElement(
0, childCount, this.toggleTruncate, true
);
}
return ( return (
<div className={this.props.className}> <div className={this.props.className}>
{childsJsx} {childsJsx}