2016-02-29 14:08:40 +08:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2016-03-11 09:42:04 +08:00
|
|
|
import { Router, Route, IndexRoute, Redirect, hashHistory } from 'react-router';
|
2016-03-08 15:13:59 +08:00
|
|
|
import antd from '../../';
|
2016-03-02 11:57:37 +08:00
|
|
|
import * as utils from './utils';
|
2016-02-29 14:08:40 +08:00
|
|
|
import '../common/lib';
|
|
|
|
import App from '../component/App';
|
|
|
|
import Home from '../component/Home';
|
2016-03-02 11:57:37 +08:00
|
|
|
import practice from '../../_site/data/practice';
|
|
|
|
import pattern from '../../_site/data/pattern';
|
2016-03-04 18:06:34 +08:00
|
|
|
import reactComponents from '../../_site/data/react-components';
|
2016-03-03 11:12:46 +08:00
|
|
|
import spec from '../../_site/data/spec';
|
2016-03-02 11:57:37 +08:00
|
|
|
import resource from '../../_site/data/resource';
|
2016-02-29 14:08:40 +08:00
|
|
|
|
2016-03-08 16:12:04 +08:00
|
|
|
// TODO: pack dependencies with atool build
|
2016-03-08 15:13:59 +08:00
|
|
|
// Expose React, ReactDOM
|
|
|
|
window.react = React;
|
|
|
|
window['react-dom'] = ReactDOM;
|
|
|
|
window.antd = antd;
|
|
|
|
|
2016-03-11 09:42:04 +08:00
|
|
|
const ReactComponents = utils.generateContainer(reactComponents);
|
2016-03-08 16:12:04 +08:00
|
|
|
const reactComponentsChildren = utils.generateChildren(reactComponents);
|
2016-02-29 14:08:40 +08:00
|
|
|
|
2016-03-11 09:42:04 +08:00
|
|
|
const Practice = utils.generateContainer(practice);
|
2016-03-03 17:23:08 +08:00
|
|
|
const practiceChildren = utils.generateChildren(practice);
|
2016-03-02 11:57:37 +08:00
|
|
|
|
2016-03-11 09:42:04 +08:00
|
|
|
const Pattern = utils.generateContainer(pattern);
|
2016-03-03 17:23:08 +08:00
|
|
|
const patternChildren = utils.generateChildren(pattern);
|
2016-03-02 11:57:37 +08:00
|
|
|
|
2016-03-11 09:42:04 +08:00
|
|
|
const Spec = utils.generateContainer(spec);
|
2016-03-08 16:12:04 +08:00
|
|
|
const specChildren = utils.generateChildren(spec);
|
2016-03-03 11:12:46 +08:00
|
|
|
|
2016-03-11 09:42:04 +08:00
|
|
|
const Resource = utils.generateContainer(resource);
|
2016-03-03 17:23:08 +08:00
|
|
|
const resourceChildren = utils.generateChildren(resource);
|
2016-02-29 14:08:40 +08:00
|
|
|
|
2016-03-03 11:12:46 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<Router history={hashHistory}>
|
|
|
|
<Route path="/" component={App}>
|
|
|
|
<IndexRoute component={Home} />
|
|
|
|
<Route path="components" component={ReactComponents}>
|
2016-03-04 18:06:34 +08:00
|
|
|
{ reactComponentsChildren }
|
2016-03-03 11:12:46 +08:00
|
|
|
</Route>
|
2016-03-11 09:42:04 +08:00
|
|
|
<Redirect from="docs/react/introduce" to="components/introduce" />
|
|
|
|
<Redirect from="docs/react/getting-started"
|
|
|
|
to="components/getting-started" />
|
|
|
|
<Redirect from="docs/react/install" to="components/install" />
|
|
|
|
<Redirect from="docs/react/upgrade-notes" to="components/upgrade-notes" />
|
|
|
|
<Redirect from="CHANGELOG" to="components/changelog" />
|
2016-03-10 16:56:17 +08:00
|
|
|
<Route path="docs/practice" component={Practice}>
|
2016-03-03 11:12:46 +08:00
|
|
|
{ practiceChildren }
|
|
|
|
</Route>
|
2016-03-10 16:56:17 +08:00
|
|
|
<Route path="docs/pattern" component={Pattern}>
|
2016-03-03 11:12:46 +08:00
|
|
|
{ patternChildren }
|
|
|
|
</Route>
|
2016-03-10 16:56:17 +08:00
|
|
|
<Route path="docs/spec" component={Spec}>
|
2016-03-03 11:12:46 +08:00
|
|
|
{ specChildren }
|
|
|
|
</Route>
|
2016-03-10 16:56:17 +08:00
|
|
|
<Route path="docs/resource" component={Resource}>
|
2016-03-03 11:12:46 +08:00
|
|
|
{ resourceChildren }
|
|
|
|
</Route>
|
2016-02-29 14:08:40 +08:00
|
|
|
</Route>
|
2016-03-03 11:12:46 +08:00
|
|
|
</Router>
|
|
|
|
, document.getElementById('react-content')
|
|
|
|
);
|