From d5ce1ecde24c1e1eddeb2f3cb6f80150cd739b6a Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 7 Jul 2015 15:56:35 +0200 Subject: [PATCH] bug fix --- .../ascribe_collapsible/collapsible_button.js | 38 +++++++++++++++++++ js/components/ascribe_detail/edition.js | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 js/components/ascribe_collapsible/collapsible_button.js diff --git a/js/components/ascribe_collapsible/collapsible_button.js b/js/components/ascribe_collapsible/collapsible_button.js new file mode 100644 index 00000000..6fb39c71 --- /dev/null +++ b/js/components/ascribe_collapsible/collapsible_button.js @@ -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 ( + + + {this.props.button} + +
+ {this.props.panel} +
+
+ ); + } +}); + +export default CollapsibleButton; diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 581d6b60..5a25401c 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -191,7 +191,7 @@ let MediaContainer = React.createClass({ } }); -const CollapsibleButton = React.createClass({ +let CollapsibleButton = React.createClass({ propTypes: { button: React.PropTypes.object,