1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

using location.hash to initialize tabview correctly

This commit is contained in:
ivaosthu 2014-11-01 15:19:10 +01:00 committed by Ivar Conradi Østhus
parent b1b3d408f7
commit 0032069c27
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;