import React from 'react'; import { FormattedMessage, injectIntl } from 'react-intl'; import { Modal, Icon, message } from 'antd'; import reqwest from 'reqwest'; 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(); } } handleColorChange = (color) => { const { messages } = this.props.intl; reqwest({ url: 'https://ant-design-theme.now.sh/compile', method: 'post', data: { variables: { '@primary-color': color, }, }, }).then((data) => { message.success(messages['app.footer.primary-color-changed']); 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: (
{messages['app.publish.greeting']} antd@2.0.0 {messages['app.publish.intro']} {messages['app.publish.old-version-guide']} 1x.ant.design {messages['app.publish.old-version-tips']}