1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

using location.hash to initialize tabview correctly

This commit is contained in:
ivaosthu 2014-11-01 15:19:10 +01:00
parent 0ba223dc4e
commit 5e3920fb42
2 changed files with 29 additions and 0 deletions

View File

@ -9,6 +9,18 @@ var TabView = React.createClass({
return {activeTab: this.props.tabPanes[0]};
},
componentDidMount:function() {
var userHash = window.location.hash;
if(userHash) {
userHash = userHash.split("#")[1];
this.props.tabPanes.forEach(function(pane) {
if(pane.name === userHash) {
this.setState({activeTab: pane})
}
}.bind(this));
}
},
handleChangeTab: function(tabPane) {
this.setState({activeTab: tabPane});
},

View File

@ -0,0 +1,17 @@
var React = require('react');
var StrategyList = React.createClass({
propTypes: {
strategies: React.PropTypes.array.isRequired
},
render: function() {
return (<div>
{JSON.stringify(this.props.strategies)}
</div>
);
}
});
module.exports = StrategyList;