summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-theme-default/src/index.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-10-01 17:43:10 +0200
committerSamy Pesse <samypesse@gmail.com>2016-10-01 23:11:50 +0200
commit8be4cbc8875e708b1a62035fb91652b891e540ac (patch)
tree775c72497603bdb3d593cc0228c9f6dff19ca3e2 /packages/gitbook-plugin-theme-default/src/index.js
parent32556e672431e9766388747285d69e65130013c0 (diff)
downloadgitbook-8be4cbc8875e708b1a62035fb91652b891e540ac.zip
gitbook-8be4cbc8875e708b1a62035fb91652b891e540ac.tar.gz
gitbook-8be4cbc8875e708b1a62035fb91652b891e540ac.tar.bz2
Add action I18n.registerLocales and locales for default theme
Diffstat (limited to 'packages/gitbook-plugin-theme-default/src/index.js')
-rw-r--r--packages/gitbook-plugin-theme-default/src/index.js52
1 files changed, 5 insertions, 47 deletions
diff --git a/packages/gitbook-plugin-theme-default/src/index.js b/packages/gitbook-plugin-theme-default/src/index.js
index 2f1a336..a07901c 100644
--- a/packages/gitbook-plugin-theme-default/src/index.js
+++ b/packages/gitbook-plugin-theme-default/src/index.js
@@ -1,56 +1,14 @@
const GitBook = require('gitbook-core');
-const { React } = GitBook;
-
-const Sidebar = require('./components/Sidebar');
-const Body = require('./components/Body');
+const Theme = require('./components/Theme');
const reduceState = require('./reducers');
+const locales = require('./i18n');
-let ThemeBody = React.createClass({
- propTypes: {
- // State
- page: GitBook.Shapes.Page,
- summary: GitBook.Shapes.Summary,
- sidebar: React.PropTypes.object,
- // Other props
- children: React.PropTypes.node
- },
-
- render() {
- const { page, summary, children, sidebar } = this.props;
-
- return (
- <GitBook.FlexLayout column className="GitBook book">
- <GitBook.Head
- title={page.title}
- titleTemplate="%s - GitBook" />
- <GitBook.ImportCSS href="gitbook/theme.css" />
-
- <GitBook.FlexBox>
- <GitBook.FlexLayout>
- {sidebar.open ? (
- <GitBook.FlexBox col={3}>
- <Sidebar summary={summary} />
- </GitBook.FlexBox>
- ) : null}
- <GitBook.FlexBox col={sidebar.open ? 9 : 12}>
- <Body page={page} />
- </GitBook.FlexBox>
- </GitBook.FlexLayout>
- </GitBook.FlexBox>
- {children}
- </GitBook.FlexLayout>
- );
- }
-});
-
-ThemeBody = GitBook.connect(ThemeBody, ({page, summary, sidebar}) => {
- return { page, summary, sidebar };
-});
module.exports = GitBook.createPlugin({
- init: (dispatch, state, { Components }) => {
- dispatch(Components.registerComponent(ThemeBody, { role: 'Body' }));
+ init: (dispatch, state, { Components, I18n }) => {
+ dispatch(Components.registerComponent(Theme, { role: 'Body' }));
+ dispatch(I18n.registerLocales(locales));
},
reduce: reduceState
});