forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request react-bootstrap#427 from react-bootstrap/collapsab…
…le-updates [changed] CollapsableMixin state tracking
- Loading branch information
Showing
10 changed files
with
449 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var CollapsableParagraph = React.createClass({ | ||
mixins: [CollapsableMixin], | ||
|
||
getCollapsableDOMNode: function(){ | ||
return this.refs.panel.getDOMNode(); | ||
}, | ||
|
||
getCollapsableDimensionValue: function(){ | ||
return this.refs.panel.getDOMNode().scrollHeight; | ||
}, | ||
|
||
onHandleToggle: function(e){ | ||
e.preventDefault(); | ||
this.setState({expanded:!this.state.expanded}); | ||
}, | ||
|
||
render: function(){ | ||
var styles = this.getCollapsableClassSet(); | ||
var text = this.isExpanded() ? 'Hide' : 'Show'; | ||
return ( | ||
<div> | ||
<Button onClick={this.onHandleToggle}>{text} Content</Button> | ||
<div ref="panel" className={classSet(styles)}> | ||
{this.props.children} | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); | ||
|
||
var panelInstance = ( | ||
<CollapsableParagraph> | ||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. | ||
</CollapsableParagraph> | ||
); | ||
|
||
React.render(panelInstance, mountNode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.