From fb3776dbd3dee50d5111bf25c9f3db2ce0037e69 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Fri, 11 Mar 2016 09:42:04 +0800 Subject: [PATCH] site: add redirect --- site/component/MainContent/index.jsx | 10 +--------- site/entry/index.jsx | 18 ++++++++++++------ site/entry/utils.js | 5 ++--- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/site/component/MainContent/index.jsx b/site/component/MainContent/index.jsx index 8b71637200..d51057e112 100644 --- a/site/component/MainContent/index.jsx +++ b/site/component/MainContent/index.jsx @@ -5,14 +5,6 @@ import { Row, Col, Menu } from '../../../'; import config from '../../website.config'; const SubMenu = Menu.SubMenu; -const fileNameUrlMap = { - 'docs/react/introduce': 'components/introduce', - 'docs/react/getting-started': 'components/getting-started', - 'docs/react/install': 'components/install', - 'docs/react/upgrade-notes': 'components/upgrade-notes', - CHANGELOG: 'components/changelog', -}; - export default class MainContent extends React.Component { componentDidMount() { this.componentDidUpdate(); @@ -54,7 +46,7 @@ export default class MainContent extends React.Component { const disabled = item.disabled === 'true'; const url = item.fileName.replace(/(\/index)?\.md$/i, ''); const child = !item.link ? - + { text } : diff --git a/site/entry/index.jsx b/site/entry/index.jsx index 7d928326b6..fe07f8d41f 100644 --- a/site/entry/index.jsx +++ b/site/entry/index.jsx @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { Router, Route, IndexRoute, hashHistory } from 'react-router'; +import { Router, Route, IndexRoute, Redirect, hashHistory } from 'react-router'; import antd from '../../'; import * as utils from './utils'; import '../common/lib'; @@ -18,19 +18,19 @@ window.react = React; window['react-dom'] = ReactDOM; window.antd = antd; -const ReactComponents = utils.generateContainer('components', reactComponents); +const ReactComponents = utils.generateContainer(reactComponents); const reactComponentsChildren = utils.generateChildren(reactComponents); -const Practice = utils.generateContainer('practice', practice); +const Practice = utils.generateContainer(practice); const practiceChildren = utils.generateChildren(practice); -const Pattern = utils.generateContainer('pattern', pattern); +const Pattern = utils.generateContainer(pattern); const patternChildren = utils.generateChildren(pattern); -const Spec = utils.generateContainer('spec', spec); +const Spec = utils.generateContainer(spec); const specChildren = utils.generateChildren(spec); -const Resource = utils.generateContainer('resource', resource); +const Resource = utils.generateContainer(resource); const resourceChildren = utils.generateChildren(resource); ReactDOM.render( @@ -40,6 +40,12 @@ ReactDOM.render( { reactComponentsChildren } + + + + + { practiceChildren } diff --git a/site/entry/utils.js b/site/entry/utils.js index e862383855..0325d1c25a 100644 --- a/site/entry/utils.js +++ b/site/entry/utils.js @@ -35,12 +35,11 @@ function getMenuItems(data) { return menuItems; } -export function generateContainer(category, data) { +export function generateContainer(data) { const menuItems = getMenuItems(data); return (props) => { return ( - + ); }; }