mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
bug fix
This commit is contained in:
parent
4a2ad0ea9d
commit
d5ce1ecde2
38
js/components/ascribe_collapsible/collapsible_button.js
Normal file
38
js/components/ascribe_collapsible/collapsible_button.js
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
let CollapsibleButton = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
panel: React.PropTypes.object,
|
||||
button: React.PropTypes.object,
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.object,
|
||||
React.PropTypes.array
|
||||
])
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return {expanded: false};
|
||||
},
|
||||
handleToggle(e){
|
||||
e.preventDefault();
|
||||
this.setState({expanded: !this.state.expanded});
|
||||
},
|
||||
render() {
|
||||
let isVisible = (this.state.expanded) ? '' : 'invisible';
|
||||
return (
|
||||
<span>
|
||||
<span onClick={this.handleToggle}>
|
||||
{this.props.button}
|
||||
</span>
|
||||
<div ref='panel' className={isVisible}>
|
||||
{this.props.panel}
|
||||
</div>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default CollapsibleButton;
|
@ -191,7 +191,7 @@ let MediaContainer = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
const CollapsibleButton = React.createClass({
|
||||
let CollapsibleButton = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
button: React.PropTypes.object,
|
||||
|
Loading…
Reference in New Issue
Block a user