accounts-frontend/src/components/footerMenu/FooterMenu.js

62 lines
1.9 KiB
JavaScript
Raw Normal View History

// @flow
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
2016-05-22 22:55:38 +05:30
import { FormattedMessage as Message } from 'react-intl';
import LanguageSwitcher from 'components/languageSwitcher';
import { create as createPopup } from 'components/ui/popup/actions';
import { ContactLink } from 'components/contact';
2016-05-22 22:55:38 +05:30
import styles from './footerMenu.scss';
import messages from './footerMenu.intl.json';
type OwnProps = {|
createContactPopup: () => void,
|};
type Props = {
...OwnProps,
createLanguageSwitcherPopup: () => void,
};
class FooterMenu extends Component<Props> {
2016-05-22 22:55:38 +05:30
static displayName = 'FooterMenu';
render() {
return (
<div className={styles.footerMenu}>
<Link to="/rules">
<Message {...messages.rules} />
</Link>
{' | '}
<ContactLink>
2016-05-22 22:55:38 +05:30
<Message {...messages.contactUs} />
</ContactLink>
{' | '}
<Link to="/dev">
<Message {...messages.forDevelopers} />
</Link>
2016-05-28 02:08:11 +05:30
<div className={styles.langTriggerContainer}>
<a href="#" className={styles.langTrigger} onClick={this.onLanguageSwitcher}>
<span className={styles.langTriggerIcon} />
<Message {...messages.siteLanguage} />
</a>
</div>
2016-05-22 22:55:38 +05:30
</div>
);
}
onLanguageSwitcher = (event: SyntheticMouseEvent<HTMLElement>) => {
2016-05-22 22:55:38 +05:30
event.preventDefault();
this.props.createLanguageSwitcherPopup();
2016-05-22 22:55:38 +05:30
};
}
// mark this component, as not pure, because it is stateless,
// but should be re-rendered, if current lang was changed
export default connect<Props, OwnProps, _, _, _, _>(null, {
createLanguageSwitcherPopup: () => createPopup({ Popup: LanguageSwitcher }),
}, null, {pure: false})(FooterMenu);