From de14ac0b63c51a818970d25de9597e7dce9053bd Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 15 May 2016 19:07:53 +0800 Subject: [PATCH 1/5] fix links --- site/component/Article/index.jsx | 14 ++++++++++++-- site/component/utils.js | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/site/component/Article/index.jsx b/site/component/Article/index.jsx index 9ba0ebb294..5dd1e9a59f 100644 --- a/site/component/Article/index.jsx +++ b/site/component/Article/index.jsx @@ -11,8 +11,18 @@ export default class Article extends React.Component { componentDidUpdate() { const { chinese, english } = this.props.content.meta; utils.setTitle(`${chinese || english} - Ant Design`); + const links = Array.apply(null, document.querySelectorAll('.outside-link.internal')); + if (links.length === 0) { + return; + } + 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')); + } + }); } - getTimelineFromArticle(article) { + getArticle(article) { const { content } = this.props; const { meta } = content; if (!meta.timeline) { @@ -69,7 +79,7 @@ export default class Article extends React.Component { null } { - this.getTimelineFromArticle(utils.jsonmlToComponent( + this.getArticle(utils.jsonmlToComponent( location.pathname, ['section', { className: 'markdown' }].concat(description) )) diff --git a/site/component/utils.js b/site/component/utils.js index ce6bc1c5f0..23886e767f 100644 --- a/site/component/utils.js +++ b/site/component/utils.js @@ -62,3 +62,19 @@ export function jsonmlToComponent(pathname, jsonml) { export function setTitle(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); +} From 5ec1ce08e30c400ae5e7b9d8242cf6b99089a613 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 15 May 2016 19:18:20 +0800 Subject: [PATCH 2/5] update site style --- site/common/styles/markdown.less | 1 + site/common/styles/toc.less | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/site/common/styles/markdown.less b/site/common/styles/markdown.less index 83a2b1ce3f..537fc2b954 100644 --- a/site/common/styles/markdown.less +++ b/site/common/styles/markdown.less @@ -159,6 +159,7 @@ .markdown .waiting { color: #ccc; + cursor: not-allowed; } .markdown h1:hover .anchor, diff --git a/site/common/styles/toc.less b/site/common/styles/toc.less index 1cbdd9fa80..38a780948e 100644 --- a/site/common/styles/toc.less +++ b/site/common/styles/toc.less @@ -42,7 +42,7 @@ .toc-affix { position: absolute; top: 8px; - right: 30px; + right: 20px; } .demos-anchor { From 3b46d06265f72ce5892415e3277d4f20a60fbaa6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 15 May 2016 20:09:47 +0800 Subject: [PATCH 3/5] fix #1686 --- site/common/styles/responsive.less | 14 ++++++++++++-- site/component/Home/index.jsx | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/site/common/styles/responsive.less b/site/common/styles/responsive.less index 6734050576..a62ffd6e91 100644 --- a/site/common/styles/responsive.less +++ b/site/common/styles/responsive.less @@ -25,7 +25,7 @@ } a#logo { - width: 144px; + width: 150px; margin-left: auto; margin-right: auto; float: none; @@ -64,8 +64,18 @@ animation: moveLeftOut .2s ease-in forwards; } - ul#nav, ul#nav li { + ul#nav, + ul#nav li { width: 100%; + font-size: 14px; + } + + ul#nav li { + line-height: 60px; + height: 60px; + a { + color: #333; + } } .toc { diff --git a/site/component/Home/index.jsx b/site/component/Home/index.jsx index 6e10643d53..c610ab37ff 100644 --- a/site/component/Home/index.jsx +++ b/site/component/Home/index.jsx @@ -54,6 +54,14 @@ export default class Home extends React.Component { .home-nav-white #nav a { 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 { color: #eee; transition: color 0.5s cubic-bezier(0.455, 0.03, 0.515, 0.955); From e28654bc143ff0a341bcf48edf5c7a9d347cef31 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 15 May 2016 21:14:27 +0800 Subject: [PATCH 4/5] Add new version info Modal for all users --- site/component/Footer/index.jsx | 35 +++++++++++++++++++++++++++------ site/website.config.js | 3 --- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/site/component/Footer/index.jsx b/site/component/Footer/index.jsx index 0ae0341b2b..c61f77f65b 100644 --- a/site/component/Footer/index.jsx +++ b/site/component/Footer/index.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Select } from 'antd'; +import { Select, Modal } from 'antd'; import { version as antdVersion } from '../../../package.json'; import { docVersions } from '../../website.config'; const Option = Select.Option; @@ -7,13 +7,36 @@ const Option = Select.Option; docVersions[antdVersion] = antdVersion; export default class Footer extends React.Component { - constructor(props) { - super(props); - - this.handleVersionChange = this.handleVersionChange.bind(this); + componentDidMount() { + // 大版本发布后全局弹窗提示 + // 1. 点击『知道了』之后不再提示 + // 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: ( +
+

+ 1.x 版本有 大量改进 + ,欢迎升级。 +

+

+ 如果您还在使用旧版本,可以访问 012x.ant.design + ,也可通过页面右下角的文档版本选择框进行切换。 +

+
+ ), + onOk: () => localStorage.setItem('infoNewVersionSent', 'true'), + }); + } + + handleVersionChange = (url) => { window.location.href = url; } diff --git a/site/website.config.js b/site/website.config.js index 4cca106acc..f2116fa664 100644 --- a/site/website.config.js +++ b/site/website.config.js @@ -1,7 +1,6 @@ export default { categoryOrder: { 组件: 0, - 十大原则: 0, 设计基础: 1, 动画: 2, @@ -13,11 +12,9 @@ export default { 导航: 3, 其它: 4, }, - redirects: { CHANGELOG: 'docs/react/changelog', }, - docVersions: { '0.9.x': 'http://09x.ant.design/', '0.10.x': 'http://010x.ant.design/', From 090527c120faa7edad7e5d5634bc9ad2baa03d40 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 15 May 2016 21:21:42 +0800 Subject: [PATCH 5/5] update text --- site/component/Footer/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/component/Footer/index.jsx b/site/component/Footer/index.jsx index c61f77f65b..7a8eb4061a 100644 --- a/site/component/Footer/index.jsx +++ b/site/component/Footer/index.jsx @@ -23,12 +23,12 @@ export default class Footer extends React.Component { content: (

- 1.x 版本有 大量改进 + 1.0 版本有 大量改进 ,欢迎升级。

- 如果您还在使用旧版本,可以访问 012x.ant.design - ,也可通过页面右下角的文档版本选择框进行切换。 + 如果您还需要使用旧版,请查阅 012x.ant.design + ,也可通过页面右下角的文档版本选择框进行切换。

),