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

fix some navigation styling #153

This commit is contained in:
ivaosthu 2016-09-30 15:09:26 +02:00 committed by Ivar Conradi Østhus
parent cd6fde6526
commit dc328f28ca
5 changed files with 22 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { ListSubHeader, List, ListItem, ListDivider } from 'react-toolbox';
import style from './style';
export default class UnleashNav extends Component {
static contextTypes = {
@ -9,10 +10,10 @@ export default class UnleashNav extends Component {
render () {
const createListItem = (path, caption) =>
<ListItem to={this.context.router.createHref(path)} caption={caption}
className={this.context.router.isActive(path) ? 'active' : 'inactive'} />;
className={this.context.router.isActive(path) ? style.active : ''} />;
return (
<List selectable ripple>
<List selectable ripple className={style.navigation}>
{createListItem('/features', 'Feature Toggles')}
{createListItem('/strategies', 'Strategies')}
{createListItem('/history', 'Event History')}

View File

@ -16,14 +16,19 @@ class AddFeatureToggle extends React.Component {
};
}
static contextTypes = {
router: React.PropTypes.object,
}
onSubmit = (evt) => {
evt.preventDefault();
this.props.dispatch(addFeatureToggle(this.state.name, this.state.enabled));
this.props.dispatch(addFeatureToggle(this.state.name));
this.context.router.push('/features');
};
handleChange = (key, value) => {
const change = {};
change[name] = value;
change[key] = value;
const newState = Object.assign({}, this.state, change);
this.setState(newState);

View File

@ -15,7 +15,10 @@ export default class FeatureList extends React.Component {
}
componentDidMount () {
this.props.fetchFeatureToggles();
// TODO: only fetch from server if we don't know about any toggles.
if (this.props.features.length === 0) {
this.props.fetchFeatureToggles();
}
}
render () {

View File

@ -5,12 +5,12 @@ export const RECEIVE_FEATURE_TOGGLES = 'RECEIVE_FEATURE_TOGGLES';
export const ERROR_RECEIVE_FEATURE_TOGGLES = 'ERROR_RECEIVE_FEATURE_TOGGLES';
export const addFeatureToggle = (featureName) => ({
type: 'ADD_FEATURE_TOGGLE',
type: ADD_FEATURE_TOGGLE,
name: featureName,
});
export const toggleFeature = (featureName) => ({
type: 'TOGGLE_FEATURE_TOGGLE',
type: TOGGLE_FEATURE_TOGGLE,
name: featureName,
});

View File

@ -6,3 +6,9 @@
top: 0;
bottom: 0;
}
.navigation {
.active {
background-color: #EEE;
}
}