summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-theme-default/src/components/Sidebar.js
blob: fd107302e9638bcc0a2205fe983420da7020f4cd (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
36
37
38
39
40
41
42
43
44
45
46
const GitBook = require('gitbook-core');
const { React } = GitBook;

const Summary = require('./Summary');

/**
 * The GitBook trademark.
 * @type {ReactClass}
 */
const GitBookTrademark = React.createClass({
    render() {
        return (
            <a className="GitBookTrademark" href="https://www.gitbook.com/?utm_source=gitbook&utm_medium=trademark" target="_blank">
                <span>Published with <b>GitBook</b></span>
                <GitBook.Image src="gitbook/theme-default/images/logo.svg" />
            </a>
        );
    }
});

/**
 * Sidebar containing a serch bar, the table of contents, and the GitBook trademark.
 * @type {ReactClass}
 */
const Sidebar = React.createClass({
    propTypes: {
        summary: GitBook.PropTypes.Summary
    },

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

        return (
            <div className="Sidebar-Flex">
                <div className="Sidebar book-summary">
                    <GitBook.InjectedComponent matching={{ role: 'search:container:input' }} />
                    <Summary summary={summary} />

                    <GitBookTrademark />
                </div>
            </div>
        );
    }
});

module.exports = Sidebar;