site: upgrade bisheng

This commit is contained in:
Benjy Cui 2016-07-26 15:24:48 +08:00
parent fec500698e
commit 6cac87fa17
6 changed files with 50 additions and 42 deletions

View File

@ -78,7 +78,7 @@
"babel-eslint": "^6.0.2",
"babel-jest": "^13.2.2",
"babel-plugin-antd": "^0.4.0",
"bisheng": "^0.7.1",
"bisheng": "^0.9.0",
"bisheng-plugin-antd": "~0.2.0",
"bisheng-plugin-description": "^0.1.1",
"bisheng-plugin-react": "^0.2.0",

View File

@ -21,13 +21,30 @@ module.exports = {
'0.12.x': 'http://012x.ant.design/',
},
routes: {
'/': './template/Home/index',
'/docs/practice/:children': contentTmpl,
'/docs/pattern/:children': contentTmpl,
'/docs/react/:children': contentTmpl,
'/changelog': contentTmpl,
'/components/:children': contentTmpl,
'/docs/spec/:children': contentTmpl,
'/docs/resource/:children': contentTmpl,
path: '/',
component: './template/Layout/index',
indexRoute: { component: './template/Home/index' },
childRoutes: [{
path: '/docs/practice/:children',
component: contentTmpl,
}, {
path: '/docs/pattern/:children',
component: contentTmpl,
}, {
path: '/docs/react/:children',
component: contentTmpl,
}, {
path: '/changelog',
component: contentTmpl,
}, {
path: '/components/:children',
component: contentTmpl,
}, {
path: '/docs/spec/:children',
component: contentTmpl,
}, {
path: '/docs/resource/:children',
component: contentTmpl,
}],
},
};

View File

@ -1,5 +1,4 @@
import React from 'react';
import Layout from '../Layout';
import MainContent from './MainContent';
import Promise from 'bluebird';
import * as utils from '../utils';
@ -41,9 +40,5 @@ export function collect(nextProps, callback) {
}
export default (props) => {
return (
<Layout {...props}>
<MainContent {...props} />
</Layout>
);
return <MainContent {...props} />;
};

View File

@ -1,20 +1,11 @@
import React from 'react';
import DocumentTitle from 'react-document-title';
import Layout from '../Layout';
import Link from './Link';
import Banner from './Banner';
import Page1 from './Page1';
import Page2 from './Page2';
import Page3 from './Page3';
import Page4 from './Page4';
import Promise from 'bluebird';
import * as utils from '../utils';
export function collect(nextProps, callback) {
const componentsList = utils.collectDocs(nextProps.data.components);
Promise.all(componentsList)
.then((list) => callback(null, { ...nextProps, components: list }));
}
export default class Home extends React.Component {
// To store style which is only for Home and has conflicts with others.
@ -96,17 +87,15 @@ export default class Home extends React.Component {
render() {
return (
<DocumentTitle title="Ant Design - 一个 UI 设计语言">
<Layout {...this.props}>
<div className="main-wrapper">
<Link />
<Banner />
<Page1 />
<Page2 />
<Page3 />
<Page4 />
<style dangerouslySetInnerHTML={{ __html: this.getStyle() }} />
</div>
</Layout>
<div className="main-wrapper">
<Link />
<Banner />
<Page1 />
<Page2 />
<Page3 />
<Page4 />
<style dangerouslySetInnerHTML={{ __html: this.getStyle() }} />
</div>
</DocumentTitle>
);
}

View File

@ -89,10 +89,10 @@ export default class Header extends React.Component {
}
render() {
const { routes, components } = this.props;
const route = routes[0].path.replace(/^\//, '');
let activeMenuItem = route.slice(0, route.indexOf(':') - 1) || 'home';
if (activeMenuItem === 'components' || route === 'changelog') {
const { location, components } = this.props;
const module = location.pathname.split('/').slice(0, -1).join('/');
let activeMenuItem = module || 'home';
if (activeMenuItem === 'components' || location.pathname === 'changelog') {
activeMenuItem = 'docs/react';
}
@ -144,7 +144,7 @@ export default class Header extends React.Component {
</Select>
</div>
{
location.port ? (
window.location.port ? (
<Button id="lang" type="ghost" size="small" onClick={this.handleLangChange}>
<FormattedMessage id="app.header.lang" />
</Button>

View File

@ -1,9 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as antd from '../../../../index';
import { addLocaleData, IntlProvider } from 'react-intl';
import Promise from 'bluebird';
import Header from './Header';
import Footer from './Footer';
import * as utils from '../utils';
import enLocale from '../../en-US.js';
import cnLocale from '../../zh-CN.js';
import '../../static/style';
@ -11,7 +12,7 @@ import '../../static/style';
// Expose to iframe
window.react = React;
window['react-dom'] = ReactDOM;
window.antd = antd;
window.antd = require('antd');
// Polyfill
const areIntlLocalesSupported = require('intl-locales-supported');
@ -42,6 +43,12 @@ const isZhCN = (typeof localStorage !== 'undefined' && localStorage.getItem('loc
const appLocale = isZhCN ? cnLocale : enLocale;
addLocaleData(appLocale.data);
export function collect(nextProps, callback) {
const componentsList = utils.collectDocs(nextProps.data.components);
Promise.all(componentsList)
.then((list) => callback(null, { ...nextProps, components: list }));
}
let gaListenerSetted = false;
export default class Layout extends React.Component {
static contextTypes = {