revert now redundant TruncatedList edits
This commit is contained in:
parent
f71ac93946
commit
ac460122cc
1 changed files with 4 additions and 22 deletions
|
@ -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 (
|
||||
<div>And {overflowCount} more...</div>
|
||||
);
|
||||
|
@ -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,12 +48,12 @@ 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
|
||||
|
@ -74,12 +62,6 @@ module.exports = React.createClass({
|
|||
}
|
||||
}
|
||||
|
||||
if (!this.state.enabled) {
|
||||
overflowJsx = this.props.createOverflowElement(
|
||||
0, childCount, this.toggleTruncate, true
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={this.props.className}>
|
||||
{childsJsx}
|
||||
|
|
Loading…
Reference in a new issue