ant-design/site/theme/template/Layout/Footer.jsx

134 lines
4.5 KiB
React
Raw Normal View History

2016-02-29 14:08:40 +08:00
import React from 'react';
import { Select, Modal } from 'antd';
import { version as antdVersion } from 'antd/package.json';
import { docVersions } from '../../';
2016-08-23 21:00:35 +08:00
2016-03-17 15:46:07 +08:00
const Option = Select.Option;
2016-02-29 14:08:40 +08:00
function isLocalStorageNameSupported() {
const testKey = 'test';
const storage = window.localStorage;
try {
storage.setItem(testKey, '1');
storage.removeItem(testKey);
return true;
} catch (error) {
return false;
}
}
2016-03-23 23:02:01 +08:00
docVersions[antdVersion] = antdVersion;
2016-02-29 14:08:40 +08:00
export default class Footer extends React.Component {
componentDidMount() {
// for some iOS
// http://stackoverflow.com/a/14555361
if (!isLocalStorageNameSupported()) {
return;
}
// 大版本发布后全局弹窗提示
// 1. 点击『知道了』之后不再提示
// 2. 超过截止日期后不再提示
2016-05-22 14:30:22 +08:00
if (localStorage.getItem('infoNewVersionSent') !== 'true' &&
new Date().getTime() < new Date('2016/05/22').getTime()) {
this.infoNewVersion();
}
}
2016-03-17 15:46:07 +08:00
infoNewVersion() {
Modal.info({
2016-05-15 22:17:05 +08:00
title: 'antd 新版发布!',
content: (
2016-05-15 22:17:05 +08:00
<div>
2016-05-16 09:43:43 +08:00
<img src="https://os.alipayobjects.com/rmsportal/nyqBompsynAQCpJ.svg" alt="Ant Design" />
<p>
2016-08-23 21:00:35 +08:00
您好<a target="_blank" rel="noopener noreferrer" href="/#/changelog">antd@1.0</a> 已正式发布欢迎升级
如果您还需要使用旧版请查阅 <a target="_blank" rel="noopener noreferrer" href="http://012x.ant.design">012x.ant.design</a>
2016-05-15 22:17:05 +08:00
也可通过页面右下角的文档版本选择框进行切换
</p>
</div>
),
onOk: () => localStorage.setItem('infoNewVersionSent', 'true'),
2016-05-15 22:17:05 +08:00
className: 'new-version-info-modal',
width: 470,
});
2016-03-17 15:46:07 +08:00
}
handleVersionChange = (url) => {
2016-03-17 15:46:07 +08:00
window.location.href = url;
}
2016-02-29 14:08:40 +08:00
render() {
2016-03-23 23:02:01 +08:00
const options = Object.keys(docVersions).map(version => (
<Option value={docVersions[version]} key={version}>{version}</Option>
));
2016-03-01 14:19:50 +08:00
return (
<footer id="footer">
<ul>
<li>
<h2>GitHub</h2>
2016-05-12 17:44:36 +08:00
<div>
<a target="_blank " href="https://github.com/ant-design/ant-design">仓库</a>
</div>
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/antd-init">antd-init</a> - 脚手架
2016-05-12 17:44:36 +08:00
</div>
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="http://ant-tool.github.io">ant-tool</a> - 开发工具
2016-05-12 17:44:36 +08:00
</div>
2016-08-16 19:20:03 +08:00
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva">dva</a> - 应用框架
2016-08-16 19:20:03 +08:00
</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2016-05-12 17:44:36 +08:00
<h2>相关站点</h2>
2016-07-29 13:52:05 +08:00
<div><a href="http://mobile.ant.design">Ant Design Mobile</a> - 移动版</div>
2016-05-14 15:17:42 +08:00
<div><a href="https://g2.alipay.com/">G2</a> - 数据可视化</div>
<div><a href="https://antv.alipay.com/">AntV</a> - 数据可视化规范</div>
2016-05-12 17:44:36 +08:00
<div><a href="http://motion.ant.design">Ant Motion</a> - 设计动效</div>
2016-05-17 00:03:28 +08:00
<div><a href="http://ux.ant.design">Ant UX</a> - 页面逻辑素材</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2016-08-16 19:20:03 +08:00
<h2>社区</h2>
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="http://ant.design/changelog">
2016-08-16 19:20:03 +08:00
更新记录
</a>
</div>
2016-05-12 17:44:36 +08:00
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues">
2016-05-12 17:44:36 +08:00
反馈和建议
</a>
</div>
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://gitter.im/ant-design/ant-design">
2016-05-12 17:44:36 +08:00
讨论
</a>
</div>
<div>
2016-08-23 21:00:35 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues/new">
2016-05-12 17:44:36 +08:00
报告 Bug
</a>
</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2016-05-12 17:44:36 +08:00
<div>©2016 蚂蚁金服体验技术部出品</div>
2016-05-27 15:43:34 +08:00
<div>Powered by <a href="https://github.com/benjycui/bisheng">BiSheng</a></div>
2016-05-12 17:44:36 +08:00
<div style={{ marginTop: 10 }}>
2016-03-01 14:19:50 +08:00
文档版本
2016-03-23 23:02:01 +08:00
<Select
size="small"
dropdownMatchSelectWidth={false}
defaultValue={antdVersion}
onChange={this.handleVersionChange}
>
2016-03-23 23:02:01 +08:00
{options}
2016-03-01 14:19:50 +08:00
</Select>
</div>
</li>
</ul>
</footer>
);
2016-02-29 14:08:40 +08:00
}
}