Skip to content

Commit

Permalink
fix some navigation styling #153
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaosthu authored and ivarconr committed Feb 20, 2020
1 parent cd6fde6 commit dc328f2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/unleash-frontend-next/src/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
4 changes: 2 additions & 2 deletions packages/unleash-frontend-next/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
6 changes: 6 additions & 0 deletions packages/unleash-frontend-next/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
top: 0;
bottom: 0;
}

.navigation {
.active {
background-color: #EEE;
}
}

0 comments on commit dc328f2

Please sign in to comment.