diff --git a/site/common/lib.js b/site/common/lib.js
index a2ae3e20f1..2a3f53f59d 100644
--- a/site/common/lib.js
+++ b/site/common/lib.js
@@ -7,3 +7,4 @@ import './styles/font.less';
import './styles/resource.less';
import './styles/clearfix.less';
import './styles/demo.less';
+import './styles/page-nav.less';
diff --git a/site/common/styles/page-nav.less b/site/common/styles/page-nav.less
new file mode 100644
index 0000000000..199b174f21
--- /dev/null
+++ b/site/common/styles/page-nav.less
@@ -0,0 +1,37 @@
+.prev-next-nav {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ overflow: hidden;
+ font-size: 16px;
+ border-top: 1px solid #e9e9e9;
+}
+
+.prev-next-nav > .prev-page,
+.prev-next-nav > .next-page {
+ padding: 0 24px;
+ width: 50%;
+ float: left;
+ line-height: 72px;
+ height: 72px;
+}
+
+.prev-next-nav > a.prev-page:before {
+ font-family: 'anticon';
+ content: '\e601';
+ font-size: 12px;
+ margin-right: 1em;
+}
+
+.prev-next-nav > .next-page {
+ text-align: right;
+ float: right;
+}
+
+.prev-next-nav > a.next-page:after {
+ font-family: 'anticon';
+ content: '\e600';
+ font-size: 12px;
+ margin-left: 1em;
+}
\ No newline at end of file
diff --git a/site/component/ComponentDoc/index.jsx b/site/component/ComponentDoc/index.jsx
index 7a6e12acd3..8e9d4a1838 100644
--- a/site/component/ComponentDoc/index.jsx
+++ b/site/component/ComponentDoc/index.jsx
@@ -19,7 +19,7 @@ export default class ComponentDoc extends React.Component {
});
return (
-
+
{doc.meta.title}
{ doc.description.map(utils.objectToComponent) }
@@ -32,7 +32,7 @@ export default class ComponentDoc extends React.Component {
{ doc.api.map(utils.objectToComponent) }
-
+
);
}
}
diff --git a/site/component/ReactComponents/index.jsx b/site/component/ReactComponents/index.jsx
index afd8eaedb3..20ad3e4cde 100644
--- a/site/component/ReactComponents/index.jsx
+++ b/site/component/ReactComponents/index.jsx
@@ -1,48 +1,70 @@
import React from 'react';
import { Link } from 'react-router';
import { Row, Col, Menu } from '../../../';
+import * as utils from '../utils';
import componentsList from '../../../_site/data/components-list';
-export default class ReactComponents extends React.Component {
- render() {
- const componentMenuItems = [];
- ['基本', '表单', '展示', '导航', '其它'].forEach((category) => {
- const grandChildren = componentsList[category].map((item) => {
- const key = item.english.toLowerCase();
- return (
-
- {item.title}
-
- );
- });
+const componentMenuItems = [];
+['基本', '表单', '展示', '导航', '其它'].forEach((category) => {
+ const grandChildren = componentsList[category].map((item) => {
+ const key = item.english.toLowerCase();
+ return (
+
+ {item.title}
+
+ );
+ });
- componentMenuItems.push(
-
- { grandChildren }
-
- );
+ componentMenuItems.push(
+
+ { grandChildren }
+
+ );
+});
+
+export default class ReactComponents extends React.Component {
+ getTopLevelMenuItems() {
+ return [
+
+ Ant Design of React
+ ,
+
+ 快速上手
+ ,
+
+ 安装
+ ,
+
+ 升级指南
+ ,
+
+ 更新日志
+ ,
+ ];
+ }
+
+ render() {
+ const routes = this.props.routes;
+ const activeMenuItem = routes[routes.length - 1].path;
+
+ const topLevelMenuItems = this.getTopLevelMenuItems();
+ const menuItems = topLevelMenuItems.concat(
+ utils.flattenMenu(componentMenuItems)
+ );
+
+ const activeMenuItemIndex = menuItems.findIndex((menuItem) => {
+ return menuItem.key === activeMenuItem;
});
+ const prev = menuItems[activeMenuItemIndex - 1];
+ const next = menuItems[activeMenuItemIndex + 1];
return (
);
diff --git a/site/component/utils.js b/site/component/utils.js
index cb884a4aad..6be0c81975 100644
--- a/site/component/utils.js
+++ b/site/component/utils.js
@@ -1,5 +1,6 @@
import React from 'react';
import hljs from 'highlight.js';
+import { Menu } from '../../';
export function objectToComponent(object, index) {
if (object === null) return;
@@ -36,3 +37,17 @@ export function objectToComponent(object, index) {
children && children.map(objectToComponent) // `hr` has no children
);
}
+
+export function flattenMenu(menu) {
+ if (menu.type === Menu.Item) {
+ return menu;
+ }
+
+ if (Array.isArray(menu)) {
+ return menu.reduce((acc, item) => {
+ return acc.concat(flattenMenu(item));
+ }, []);
+ }
+
+ return flattenMenu(menu.props.children);
+}