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

240 lines
8.1 KiB
React
Raw Normal View History

2016-02-29 14:08:40 +08:00
import React from 'react';
import { FormattedMessage, injectIntl } from 'react-intl';
2017-09-04 11:55:45 +08:00
import { Modal, Icon, message } from 'antd';
import { isLocalStorageNameSupported, loadScript } from '../utils';
import ColorPicker from '../Color/ColorPicker';
class Footer extends React.Component {
constructor(props) {
super(props);
this.lessLoaded = false;
this.state = {
color: '#108ee9',
};
}
componentDidMount() {
// for some iOS
// http://stackoverflow.com/a/14555361
if (!isLocalStorageNameSupported()) {
return;
}
// 大版本发布后全局弹窗提示
// 1. 点击『知道了』之后不再提示
// 2. 超过截止日期后不再提示
if (
localStorage.getItem('antd@2.0.0-notification-sent') !== 'true' &&
Date.now() < new Date('2016/10/14').getTime()
) {
this.infoNewVersion();
}
}
2016-03-17 15:46:07 +08:00
handleColorChange = (color) => {
const changeColor = () => {
const { messages } = this.props.intl;
window.less.modifyVars({
'@primary-color': color,
}).then(() => {
message.success(messages['app.footer.primary-color-changed']);
this.setState({ color });
});
};
const lessUrl = 'https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js';
if (this.lessLoaded) {
changeColor();
} else {
window.less = {
async: true,
};
loadScript(lessUrl).then(() => {
this.lessLoaded = true;
changeColor();
});
}
}
infoNewVersion() {
2017-10-09 13:23:20 +08:00
const { messages } = this.props.intl;
Modal.info({
title: messages['app.publish.title'],
content: (
<div>
<img src="https://os.alipayobjects.com/rmsportal/nyqBompsynAQCpJ.svg" alt="Ant Design" />
<p>
{messages['app.publish.greeting']}
<a target="_blank" rel="noopener noreferrer" href="/changelog">antd@2.0.0</a>
{messages['app.publish.intro']}
{messages['app.publish.old-version-guide']}
<a target="_blank" rel="noopener noreferrer" href="http://1x.ant.design">1x.ant.design</a>
{messages['app.publish.old-version-tips']}
</p>
</div>
),
okText: 'OK',
onOk: () => localStorage.setItem('antd@2.0.0-notification-sent', 'true'),
className: 'new-version-info-modal',
width: 470,
});
}
2016-02-29 14:08:40 +08:00
render() {
2016-03-01 14:19:50 +08:00
return (
<footer id="footer">
<ul>
<li>
2017-09-04 11:55:45 +08:00
<h2><Icon type="github" /> Ant Design</h2>
2016-05-12 17:44:36 +08:00
<div>
<a target="_blank " href="https://github.com/ant-design/ant-design">
2017-09-04 11:55:45 +08:00
GitHub
</a>
2016-05-12 17:44:36 +08:00
</div>
<div>
2017-09-04 11:55:45 +08:00
<a href="http://mobile.ant.design">Ant Design Mobile</a>
</div>
<div>
<a href="http://ng.ant.design">NG-ZORRO</a>
<span> - </span>
Ant Design of Angular
2016-05-12 17:44:36 +08:00
</div>
2016-08-16 19:20:03 +08:00
<div>
2017-02-16 16:25:42 +08:00
<a target="_blank " href="https://github.com/websemantics/awesome-ant-design">
<FormattedMessage id="app.footer.awesome" />
</a>
2016-08-16 19:20:03 +08:00
</div>
2017-09-04 11:55:45 +08:00
<div style={{ marginTop: 12 }}>
<ColorPicker
type="sketch"
small
color={this.state.color}
2017-09-04 12:24:40 +08:00
position="top"
presetColors={[
2017-10-11 16:21:55 +08:00
'#F5222D',
'#FA541C',
'#FA8C16',
'#FAAD14',
'#FADB14',
'#A0D911',
'#52C41A',
'#13C2C2',
'#1890FF',
'#2F54EB',
'#722ED1',
'#EB2F96',
]}
onChangeComplete={this.handleColorChange}
/>
</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2017-09-04 11:55:45 +08:00
<h2><Icon type="link" /> <FormattedMessage id="app.footer.resources" /></h2>
2017-05-13 16:12:35 +08:00
<div>
<a href="http://scaffold.ant.design">Scaffolds</a>
<span> - </span>
<FormattedMessage id="app.footer.scaffolds" />
</div>
2017-02-16 16:25:42 +08:00
<div>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva">dva</a> - <FormattedMessage id="app.footer.dva" />
</div>
<div>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva-cli">dva-cli</a> -
<FormattedMessage id="app.footer.dev-tools" />
</div>
2017-03-02 14:28:23 +08:00
<div>
<a target="_blank" rel="noopener noreferrer" href="https://eggjs.org/">Egg</a>
<span> - </span>
<FormattedMessage id="app.footer.eggjs" />
</div>
2016-10-07 14:33:08 +08:00
<div>
2017-03-02 14:25:04 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://antv.alipay.com/">AntV</a>
2016-10-07 14:33:08 +08:00
<span> - </span>
2017-02-07 14:57:09 +08:00
<FormattedMessage id="app.footer.data-vis" />
</div>
2016-10-07 14:33:08 +08:00
<div>
2017-03-02 14:25:04 +08:00
<a target="_blank" rel="noopener noreferrer" href="http://motion.ant.design">Ant Motion</a>
2016-10-07 14:33:08 +08:00
<span> - </span>
<FormattedMessage id="app.footer.motion" />
</div>
2016-10-07 14:33:08 +08:00
<div>
2017-03-02 14:25:04 +08:00
<a target="_blank" rel="noopener noreferrer" href="http://library.ant.design/">AntD Library</a>
2016-10-07 14:33:08 +08:00
<span> - </span>
<FormattedMessage id="app.footer.antd-library" />
</div>
2016-10-07 14:33:08 +08:00
<div>
2017-03-02 14:25:04 +08:00
<a target="_blank" rel="noopener noreferrer" href="http://ux.ant.design">Ant UX</a>
2016-10-07 14:33:08 +08:00
<span> - </span>
2017-02-16 16:25:42 +08:00
<FormattedMessage id="app.footer.antux" />
</div>
2017-06-25 20:00:06 +08:00
<div>
<a target="_blank" rel="noopener noreferrer" href="http://enclose.io/">Enclose.IO</a>
<span> - </span>
<FormattedMessage id="app.footer.encloseio" />
</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2017-02-07 19:54:30 +08:00
<h2><Icon type="customer-service" /> <FormattedMessage id="app.footer.community" /></h2>
2016-08-16 19:20:03 +08:00
<div>
2017-03-02 14:25:04 +08:00
<a href="/changelog">
<FormattedMessage id="app.footer.change-log" />
2016-08-16 19:20:03 +08:00
</a>
</div>
2016-05-12 17:44:36 +08:00
<div>
2017-02-16 16:25:42 +08:00
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/wiki/FAQ">
<FormattedMessage id="app.footer.faq" />
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">
2017-04-11 18:13:58 +08:00
<FormattedMessage id="app.footer.discuss-cn" />
</a>
</div>
<div>
<a target="_blank" rel="noopener noreferrer" href="https://gitter.im/ant-design/ant-design-english">
<FormattedMessage id="app.footer.discuss-en" />
2016-05-12 17:44:36 +08:00
</a>
</div>
<div>
2017-04-02 14:03:42 +08:00
<a target="_blank" rel="noopener noreferrer" href="http://new-issue.ant.design/">
<FormattedMessage id="app.footer.bug-report" />
2016-05-12 17:44:36 +08:00
</a>
</div>
2017-04-02 14:03:42 +08:00
<div>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues">
<FormattedMessage id="app.footer.issues" />
</a>
</div>
2017-02-16 16:25:42 +08:00
<div>
<a target="_blank" rel="noopener noreferrer" href="http://stackoverflow.com/questions/tagged/antd">
<FormattedMessage id="app.footer.stackoverflow" />
</a>
</div>
<div>
<a target="_blank" rel="noopener noreferrer" href="https://segmentfault.com/t/antd">
<FormattedMessage id="app.footer.segmentfault" />
</a>
</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2017-02-28 21:47:51 +08:00
<h2>Copyright © {new Date().getFullYear()}</h2>
2017-02-16 16:25:42 +08:00
<div>
<FormattedMessage id="app.footer.author" />
</div>
2017-03-02 14:25:04 +08:00
<div>
Built with&nbsp;
<a target="_blank" rel="noopener noreferrer" href="https://github.com/benjycui/bisheng">
BiSheng
</a>
</div>
2016-03-01 14:19:50 +08:00
</li>
</ul>
</footer>
);
2016-02-29 14:08:40 +08:00
}
}
export default injectIntl(Footer);