Merge branch 'master' of github.com:ant-design/ant-design

This commit is contained in:
偏右 2016-05-15 21:22:20 +08:00
commit a3d4e7a696
8 changed files with 79 additions and 14 deletions

View File

@ -159,6 +159,7 @@
.markdown .waiting { .markdown .waiting {
color: #ccc; color: #ccc;
cursor: not-allowed;
} }
.markdown h1:hover .anchor, .markdown h1:hover .anchor,

View File

@ -25,7 +25,7 @@
} }
a#logo { a#logo {
width: 144px; width: 150px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
float: none; float: none;
@ -64,8 +64,18 @@
animation: moveLeftOut .2s ease-in forwards; animation: moveLeftOut .2s ease-in forwards;
} }
ul#nav, ul#nav li { ul#nav,
ul#nav li {
width: 100%; width: 100%;
font-size: 14px;
}
ul#nav li {
line-height: 60px;
height: 60px;
a {
color: #333;
}
} }
.toc { .toc {

View File

@ -42,7 +42,7 @@
.toc-affix { .toc-affix {
position: absolute; position: absolute;
top: 8px; top: 8px;
right: 30px; right: 20px;
} }
.demos-anchor { .demos-anchor {

View File

@ -11,8 +11,18 @@ export default class Article extends React.Component {
componentDidUpdate() { componentDidUpdate() {
const { chinese, english } = this.props.content.meta; const { chinese, english } = this.props.content.meta;
utils.setTitle(`${chinese || english} - Ant Design`); utils.setTitle(`${chinese || english} - Ant Design`);
const links = Array.apply(null, document.querySelectorAll('.outside-link.internal'));
if (links.length === 0) {
return;
} }
getTimelineFromArticle(article) { const checkImgUrl = 'http://alipay-rmsdeploy-dev-image.oss-cn-hangzhou-zmf.aliyuncs.com/rmsportal/JdVaTbZzPxEldUi.png';
utils.ping(checkImgUrl, status => {
if (status === 'responded') {
links.forEach(link => (link.style.display = 'block'));
}
});
}
getArticle(article) {
const { content } = this.props; const { content } = this.props;
const { meta } = content; const { meta } = content;
if (!meta.timeline) { if (!meta.timeline) {
@ -69,7 +79,7 @@ export default class Article extends React.Component {
null null
} }
{ {
this.getTimelineFromArticle(utils.jsonmlToComponent( this.getArticle(utils.jsonmlToComponent(
location.pathname, location.pathname,
['section', { className: 'markdown' }].concat(description) ['section', { className: 'markdown' }].concat(description)
)) ))

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Select } from 'antd'; import { Select, Modal } from 'antd';
import { version as antdVersion } from '../../../package.json'; import { version as antdVersion } from '../../../package.json';
import { docVersions } from '../../website.config'; import { docVersions } from '../../website.config';
const Option = Select.Option; const Option = Select.Option;
@ -7,13 +7,36 @@ const Option = Select.Option;
docVersions[antdVersion] = antdVersion; docVersions[antdVersion] = antdVersion;
export default class Footer extends React.Component { export default class Footer extends React.Component {
constructor(props) { componentDidMount() {
super(props); //
// 1.
this.handleVersionChange = this.handleVersionChange.bind(this); // 2.
if (localStorage.getItem('infoNewVersionSent') !== 'true' ||
new Date().getTime() > new Date('2016/05/22').getTime()) {
this.infoNewVersion();
}
} }
handleVersionChange(url) { infoNewVersion() {
Modal.info({
title: '尊敬的用户antd@1.0 已正式发布。',
content: (
<div style={{ marginTop: '1em' }}>
<p>
1.0 版本有 <a target="_blank" href="/#/changelog">大量改进</a>
欢迎升级
</p>
<p style={{ marginTop: '1em' }}>
如果您还需要使用旧版请查阅 <a target="_blank" href="http://012x.ant.design">012x.ant.design</a>
也可通过页面右下角的文档版本选择框进行切换
</p>
</div>
),
onOk: () => localStorage.setItem('infoNewVersionSent', 'true'),
});
}
handleVersionChange = (url) => {
window.location.href = url; window.location.href = url;
} }

View File

@ -54,6 +54,14 @@ export default class Home extends React.Component {
.home-nav-white #nav a { .home-nav-white #nav a {
color: #666; color: #666;
} }
.nav-phone-icon:before {
background: #eee;
box-shadow: 0 7px 0 0 #eee, 0 14px 0 0 #eee;
}
.home-nav-white .nav-phone-icon:before {
background: #777;
box-shadow: 0 7px 0 0 #777, 0 14px 0 0 #777;
}
#nav a { #nav a {
color: #eee; color: #eee;
transition: color 0.5s cubic-bezier(0.455, 0.03, 0.515, 0.955); transition: color 0.5s cubic-bezier(0.455, 0.03, 0.515, 0.955);

View File

@ -62,3 +62,19 @@ export function jsonmlToComponent(pathname, jsonml) {
export function setTitle(title) { export function setTitle(title) {
document.title = title; document.title = title;
} }
export function ping(url, callback) {
const img = new Image();
let done;
const finish = (status) => {
if (!done) {
done = true;
img.src = '';
callback(status);
}
};
img.onload = () => finish('responded');
img.onerror = () => finish('error');
img.src = url;
setTimeout(() => finish('timeout'), 1500);
}

View File

@ -1,7 +1,6 @@
export default { export default {
categoryOrder: { categoryOrder: {
组件: 0, 组件: 0,
十大原则: 0, 十大原则: 0,
设计基础: 1, 设计基础: 1,
动画: 2, 动画: 2,
@ -13,11 +12,9 @@ export default {
导航: 3, 导航: 3,
其它: 4, 其它: 4,
}, },
redirects: { redirects: {
CHANGELOG: 'docs/react/changelog', CHANGELOG: 'docs/react/changelog',
}, },
docVersions: { docVersions: {
'0.9.x': 'http://09x.ant.design/', '0.9.x': 'http://09x.ant.design/',
'0.10.x': 'http://010x.ant.design/', '0.10.x': 'http://010x.ant.design/',