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

234 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';
import { Modal, Icon } from 'antd';
import reqwest from 'reqwest';
2017-02-21 13:36:17 +08:00
import { isLocalStorageNameSupported } from '../utils';
import ColorPicker from '../Color/ColorPicker';
class Footer extends React.Component {
constructor(props) {
super(props);
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) => {
reqwest({
url: 'https://ant-design-theme.now.sh/compile',
method: 'post',
data: {
variables: {
'@primary-color': color,
},
},
}).then((data) => {
this.setState({ color });
const head = document.querySelector('head');
const style = document.createElement('style');
style.innerText = data;
head.appendChild(style);
});
}
infoNewVersion() {
const messages = this.props.intl.messages;
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-02-07 19:54:30 +08:00
<h2><Icon type="github" /> GitHub</h2>
2016-05-12 17:44:36 +08:00
<div>
<a target="_blank " href="https://github.com/ant-design/ant-design">
<FormattedMessage id="app.footer.repo" />
</a>
2016-05-12 17:44:36 +08:00
</div>
<div>
2017-02-16 16:25:42 +08:00
<a target="_blank " href="https://ant.design/docs/react/customize-theme">
<FormattedMessage id="app.footer.customize-theme" />
</a>
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>
<div>
<ColorPicker
type="sketch"
small
color={this.state.color}
presetColors={[
'#f04134',
'#00a854',
'#108ee9',
'#f5317f',
'#f56a00',
'#7265e6',
'#ffbf00',
'#00a2ae',
'#bfbfbf',
]}
onChangeComplete={this.handleColorChange}
/>
</div>
2016-03-01 14:19:50 +08:00
</li>
<li>
2017-02-07 19:54:30 +08:00
<h2><Icon type="link" /> <FormattedMessage id="app.footer.links" /></h2>
2016-10-07 14:33:08 +08:00
<div>
<a href="http://mobile.ant.design">Ant Design Mobile</a>
<span> - </span>
<FormattedMessage id="app.footer.mobile" />
</div>
2017-08-15 23:00:06 +08:00
<div>
<a href="http://ng.ant.design">NG-ZORRO</a>
<span> - </span>
Ant Design of Angular
</div>
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);