61 lines
2.1 KiB
TypeScript
Raw Normal View History

import React, { ComponentType, MouseEventHandler, useCallback } from 'react';
import { Link } from 'react-router-dom';
2016-05-22 20:25:38 +03:00
import { FormattedMessage as Message } from 'react-intl';
import { useReduxDispatch } from 'app/functions';
import LanguageSwitcher from 'app/components/languageSwitcher';
2020-07-09 21:59:54 +03:00
import SourceCode from 'app/components/sourceCode';
import { create as createPopup } from 'app/components/ui/popup/actions';
import { ContactLink } from 'app/components/contact';
2016-05-22 20:25:38 +03:00
import styles from './footerMenu.scss';
const FooterMenu: ComponentType = () => {
const dispatch = useReduxDispatch();
2020-07-09 21:59:54 +03:00
const createPopupHandler = useCallback(
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> => (event) => {
2020-05-24 02:08:24 +03:00
event.preventDefault();
2020-07-09 21:59:54 +03:00
dispatch(createPopup({ Popup: popup }));
2020-05-24 02:08:24 +03:00
},
[dispatch],
);
2020-05-24 02:08:24 +03:00
return (
<div className={styles.footerMenu} data-testid="footer">
2020-07-09 02:50:40 +03:00
<div className={styles.row}>
<Link to="/rules" className={styles.footerItem}>
<Message key="rules" defaultMessage="Rules" />
</Link>
{'ꞏ'}
<ContactLink className={styles.footerItem}>
<Message key="contactUs" defaultMessage="Contact Us" />
</ContactLink>
</div>
<div className={styles.row}>
<Link to="/dev" className={styles.footerItem}>
<Message key="forDevelopers" defaultMessage="For developers" />
</Link>
{'ꞏ'}
2020-07-09 21:59:54 +03:00
<a href="#" className={styles.footerItem} onClick={createPopupHandler(SourceCode)}>
2020-07-09 02:50:40 +03:00
<Message key="sourceCode" defaultMessage="Source code" />
</a>
</div>
<div className={styles.row}>
2020-07-09 21:59:54 +03:00
<a href="#" className={styles.footerItem} onClick={createPopupHandler(LanguageSwitcher)}>
2020-05-24 02:08:24 +03:00
<span className={styles.langTriggerIcon} />
<Message key="siteLanguage" defaultMessage="Site language" />
2020-05-24 02:08:24 +03:00
</a>
</div>
</div>
);
};
2016-05-22 20:25:38 +03:00
export default FooterMenu;