mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable
This commit is contained in:
commit
c1607954db
@ -78,7 +78,7 @@
|
||||
"babel-eslint": "^6.0.2",
|
||||
"babel-jest": "^13.2.2",
|
||||
"babel-plugin-antd": "^0.4.0",
|
||||
"bisheng": "^0.10.0",
|
||||
"bisheng": "^0.12.0",
|
||||
"bisheng-plugin-antd": "~0.2.0",
|
||||
"bisheng-plugin-description": "^0.1.1",
|
||||
"bisheng-plugin-react": "^0.2.0",
|
||||
|
@ -7,7 +7,24 @@ module.exports = {
|
||||
'./docs',
|
||||
'CHANGELOG.md', // TODO: fix it in bisheng
|
||||
],
|
||||
lazyLoad: true,
|
||||
lazyLoad(nodePath, nodeValue) {
|
||||
if (typeof nodeValue === 'string') {
|
||||
return true;
|
||||
}
|
||||
return nodePath.endsWith('/demo');
|
||||
},
|
||||
pick: {
|
||||
components(markdownData) {
|
||||
const filename = markdownData.meta.filename;
|
||||
if (!/^components/.test(filename) ||
|
||||
/\/demo$/.test(path.dirname(filename)) ||
|
||||
/\.en-US\.md/.test(filename)) return;
|
||||
|
||||
return {
|
||||
meta: markdownData.meta,
|
||||
};
|
||||
},
|
||||
},
|
||||
theme: './site/theme',
|
||||
htmlTemplate: './site/theme/static/template.html',
|
||||
plugins: [
|
||||
|
@ -37,7 +37,7 @@ module.exports = {
|
||||
path: 'changelog',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: 'components/:children',
|
||||
path: 'components/:children/',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: 'docs/spec/:children',
|
||||
|
@ -59,7 +59,7 @@ export default class MainContent extends React.Component {
|
||||
const disabled = item.disabled;
|
||||
const url = item.filename.replace(/(\/index)?((\.zh-CN)|(\.en-US))?\.md$/i, '').toLowerCase();
|
||||
const child = !item.link ?
|
||||
<Link to={url} disabled={disabled}>
|
||||
<Link to={/^components/.test(url) ? `${url}/` : url} disabled={disabled}>
|
||||
{text}
|
||||
</Link> :
|
||||
<a href={item.link} target="_blank" disabled={disabled}>
|
||||
|
@ -26,9 +26,7 @@ export function collect(nextProps, callback) {
|
||||
|
||||
const promises = [Promise.all(componentsList), Promise.all(moduleDocs)];
|
||||
if (demos) {
|
||||
promises.push(Promise.all(
|
||||
Object.keys(demos).map((key) => demos[key]())
|
||||
));
|
||||
promises.push(demos());
|
||||
}
|
||||
Promise.all(promises)
|
||||
.then((list) => callback(null, {
|
||||
|
@ -73,7 +73,7 @@ export default class Header extends React.Component {
|
||||
}
|
||||
|
||||
handleSearch = (value) => {
|
||||
this.context.router.push({ pathname: value });
|
||||
this.context.router.push({ pathname: `${value}/` });
|
||||
}
|
||||
|
||||
handleSelectFilter = (value, option) => {
|
||||
@ -89,8 +89,11 @@ export default class Header extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { location, components } = this.props;
|
||||
const module = location.pathname.split('/').slice(0, -1).join('/');
|
||||
const { location, picked } = this.props;
|
||||
const components = picked.components;
|
||||
const module = location.pathname.replace(/\/$/, '')
|
||||
.split('/').slice(0, -1)
|
||||
.join('/');
|
||||
let activeMenuItem = module || 'home';
|
||||
if (activeMenuItem === 'components' || location.pathname === 'changelog') {
|
||||
activeMenuItem = 'docs/react';
|
||||
|
@ -1,10 +1,8 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
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';
|
||||
@ -42,12 +40,6 @@ 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 }));
|
||||
}
|
||||
|
||||
export default class Layout extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
|
Loading…
Reference in New Issue
Block a user