Updating Footer to use hooks
This commit is contained in:
parent
e01b6d424e
commit
c6020a225f
@ -1,13 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { withTranslation, Trans } from 'react-i18next';
|
import { useTranslation, Trans } from 'react-i18next';
|
||||||
|
|
||||||
import ccLogo from './cc-by.svg';
|
import ccLogo from './cc-by.svg';
|
||||||
|
|
||||||
import style from './style.module.css';
|
import style from './style.module.css';
|
||||||
|
|
||||||
export const Footer = ({ t, buildId }) => (
|
export const Footer = ({ buildId }) => {
|
||||||
<footer className={ style.footer }>
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return <footer className={ style.footer }>
|
||||||
<ul className={ style.list }>
|
<ul className={ style.list }>
|
||||||
<li>
|
<li>
|
||||||
<Trans>Created by <a
|
<Trans>Created by <a
|
||||||
@ -26,12 +28,11 @@ export const Footer = ({ t, buildId }) => (
|
|||||||
<div className={ style.buildId }>
|
<div className={ style.buildId }>
|
||||||
{ buildId }
|
{ buildId }
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>;
|
||||||
);
|
};
|
||||||
|
|
||||||
Footer.propTypes = {
|
Footer.propTypes = {
|
||||||
t: PropTypes.func.isRequired,
|
|
||||||
buildId: PropTypes.string.isRequired
|
buildId: PropTypes.string.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withTranslation()(Footer);
|
export default Footer;
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { render } from 'react-testing-library';
|
import { render } from 'react-testing-library';
|
||||||
|
|
||||||
import { mockT } from 'i18n';
|
import { mockT } from 'i18n';
|
||||||
import { Footer } from 'components/Footer';
|
import Footer from 'components/Footer';
|
||||||
|
|
||||||
describe('Footer', () => {
|
describe('Footer', () => {
|
||||||
test('rendering', () => {
|
test('rendering', () => {
|
||||||
|
@ -20,7 +20,7 @@ exports[`Layout rendering 1`] = `
|
|||||||
Example content
|
Example content
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(Footer)"
|
data-component="Footer"
|
||||||
data-props="{
|
data-props="{
|
||||||
\\"buildId\\": \\"test-buildid\\"
|
\\"buildId\\": \\"test-buildid\\"
|
||||||
}"
|
}"
|
||||||
|
Loading…
Reference in New Issue
Block a user