Updating Footer to use hooks

This commit is contained in:
Jeff Avallone 2019-03-26 20:39:40 -04:00
parent e01b6d424e
commit c6020a225f
3 changed files with 10 additions and 9 deletions

View File

@ -1,13 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withTranslation, Trans } from 'react-i18next';
import { useTranslation, Trans } from 'react-i18next';
import ccLogo from './cc-by.svg';
import style from './style.module.css';
export const Footer = ({ t, buildId }) => (
<footer className={ style.footer }>
export const Footer = ({ buildId }) => {
const { t } = useTranslation();
return <footer className={ style.footer }>
<ul className={ style.list }>
<li>
<Trans>Created by <a
@ -26,12 +28,11 @@ export const Footer = ({ t, buildId }) => (
<div className={ style.buildId }>
{ buildId }
</div>
</footer>
);
</footer>;
};
Footer.propTypes = {
t: PropTypes.func.isRequired,
buildId: PropTypes.string.isRequired
};
export default withTranslation()(Footer);
export default Footer;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { render } from 'react-testing-library';
import { mockT } from 'i18n';
import { Footer } from 'components/Footer';
import Footer from 'components/Footer';
describe('Footer', () => {
test('rendering', () => {

View File

@ -20,7 +20,7 @@ exports[`Layout rendering 1`] = `
Example content
</span>
<span
data-component="withI18nextTranslation(Footer)"
data-component="Footer"
data-props="{
\\"buildId\\": \\"test-buildid\\"
}"