summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-fontsettings/src/reducers/font.js
blob: fff582dd78dea1d7ee2066c8839a16c68cef116d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const GitBook = require('gitbook-core');
const { Record } = GitBook.Immutable;

const { TYPES } = require('../actions/font');

const FontState = Record({
    fontSize: 1
});

module.exports = (state = FontState(), action) => {
    switch (action.type) {

    case TYPES.RESET:
        return FontState();

    case TYPES.INCREASE:
        return state.merge({
            fontSize: state.fontSize + 1
        });

    case TYPES.DECREASE:
        return state.merge({
            fontSize: state.fontSize + 1
        });

    default:
        return state;
    }
};