Created
June 18, 2014 17:51
-
-
Save stevoland/77697cc77fb457c4f509 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** @jsx React.DOM */ | |
var PanelGroup = ReactBootstrap.PanelGroup; | |
var Panel = ReactBootstrap.Panel; | |
var mountNode = document.body; | |
var renderedInstance; | |
var PanelGroups = React.createClass({ | |
render: function() { | |
return ( | |
<PanelGroup activeKey={this.props.activeKey} onSelect={this.props.onSelect} isAccordion> | |
<Panel header="Title 1" key={1}> | |
<p>Content 1</p> | |
</Panel> | |
<Panel header="Title 2" key={2}> | |
<p>Content 2</p> | |
</Panel> | |
</PanelGroup> | |
); | |
} | |
}); | |
var Contract = React.createClass({ | |
getInitialState: function () { | |
activeKey: 1 | |
}, | |
handleSelect: function (selectedKey) { | |
this.setState({ | |
activeKey: selectedKey | |
}); | |
}, | |
render: function() { | |
return ( | |
<div> | |
<p>Custom stuff</p> | |
<PanelGroups activeKey={this.state.activeKey} onSelect={this.handleSelect} /> | |
</div> | |
); | |
} | |
}); | |
renderedInstance = React.renderComponent(<Contract />, mountNode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It worked with:
Thanks!