summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-theme-default/src/index.js
blob: 86b2135da8d3c68a68efddba91f4c0a9ce8c6cd0 (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
30
31
32
33
34
35
const React = require('react');
const GitBook = require('gitbook-core');

const Sidebar = require('./Sidebar');
const Page = require('./Page');

let ThemeBody = React.createClass({
    propTypes: {
        page: GitBook.Shapes.Page
    },

    render() {
        const { page } = this.props;

        return (
            <div className="GitBook book">
                <GitBook.Head
                    title={page.title}
                    titleTemplate="%s - GitBook"
                />

                <Sidebar />
                <Page page={page} />
            </div>
        );
    }
});

ThemeBody = GitBook.connect(ThemeBody, ({page}) => {
    return { page };
});

module.exports = GitBook.createPlugin((dispatch, state) => {
    dispatch(GitBook.registerComponent(ThemeBody, { role: 'Body' }));
});