summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-theme-default/src/components/Toolbar.js
blob: de89f97ef43ec1e4648530c8f9dd1b9a010ae91c (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
const React = require('react');
const GitBook = require('gitbook-core');

const sidebar = require('../actions/sidebar');

const Toolbar = React.createClass({
    propTypes: {
        dispatch: React.PropTypes.func
    },

    onToggle() {
        const { dispatch } = this.props;
        dispatch(sidebar.toggle());
    },

    render() {
        return (
            <div className="Toolbar book-toolbar">
                <button onClick={this.onToggle}>Toggle</button>
                <GitBook.InjectedComponentSet matching={{ role: 'toolbar:buttons:left' }} />
                <GitBook.InjectedComponentSet matching={{ role: 'toolbar:buttons:right' }} />
            </div>
        );
    }
});

module.exports = GitBook.connect(Toolbar);