second commit :S

This commit is contained in:
Jori Lallo
2016-02-28 19:02:39 -08:00
parent af30485e9f
commit 8d7f52a04c
11 changed files with 120 additions and 20 deletions

View File

@@ -4,10 +4,11 @@ import { combineReducers } from 'redux';
import {
UPDATE_TEXT,
TOGGLE_EDITORS,
TOGGLE_HISTORY_SIDEBAR,
ActiveEditors,
} from '../Actions';
function activeEditors(state = [ActiveEditors.MARKDOWN, ActiveEditors.TEXT], action) {
const activeEditors = (state = [ActiveEditors.MARKDOWN, ActiveEditors.TEXT], action) => {
switch (action.type) {
case TOGGLE_EDITORS: {
const newState = _.xor(state, [action.toggledEditor]);
@@ -22,7 +23,20 @@ function activeEditors(state = [ActiveEditors.MARKDOWN, ActiveEditors.TEXT], act
}
}
function text(state = '', action) {
const historySidebar = (state = { visible: false }, action) => {
switch (action.type) {
case TOGGLE_HISTORY_SIDEBAR: {
return {
...state,
visible: !state.visible,
};
}
default:
return state;
}
}
const text = (state = '', action) => {
switch (action.type) {
case UPDATE_TEXT:
return action.text;
@@ -31,9 +45,8 @@ function text(state = '', action) {
}
}
const application = combineReducers({
export default combineReducers({
activeEditors,
historySidebar,
text,
});
export default application;