Add new version info Modal for all users

This commit is contained in:
afc163 2016-05-15 21:14:27 +08:00
parent 3b46d06265
commit e28654bc14
2 changed files with 29 additions and 9 deletions

View File

@ -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: (
<div style={{ marginTop: '1em' }}>
<p>
1.x 版本有 <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;
}

View File

@ -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/',