forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes expand/collapse animation for stand-alone panel * Fixes react-bootstrap#399, where the panel would stay a fixed size * Added basic CollapsableParagraph example * Added aria-expanded attributes to Panel Fixes react-bootstrap#399
- Loading branch information
1 parent
f7808bd
commit de6f7dd
Showing
8 changed files
with
424 additions
and
86 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
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.