summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-theme-default/src/reducers/sidebar.js
blob: 7b4eac64431a2bca26afd69e70a0992f907c34cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const { Record } = require('immutable');
const ActionTypes = require('../actions/types');

const SidebarState = Record({
    open: true
});

function reduceSidebar(state = SidebarState(), action) {
    switch (action.type) {
    case ActionTypes.TOGGLE_SIDEBAR:
        return state.set('open', !state.get('open'));
    default:
        return state;
    }
}

module.exports = reduceSidebar;