From f9b3d5dbd78103140d168797c4dbc9b67a3521f9 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Tue, 26 Mar 2019 20:42:16 -0400 Subject: [PATCH] Updating PrivacyPolicy to use hooks --- .../Header/__snapshots__/test.js.snap | 14 +++++++------- src/components/PrivacyPolicy/index.js | 17 +++++++---------- src/components/PrivacyPolicy/test.js | 5 ++--- src/pages/__snapshots__/privacy.test.js.snap | 2 +- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/components/Header/__snapshots__/test.js.snap b/src/components/Header/__snapshots__/test.js.snap index 0016f11..332bdd7 100644 --- a/src/components/Header/__snapshots__/test.js.snap +++ b/src/components/Header/__snapshots__/test.js.snap @@ -9,7 +9,7 @@ exports[`Header opening the Privacy Policy modal 1`] = ` }" > @@ -85,7 +85,7 @@ exports[`Header opening the Privacy Policy modal while holding alt key 1`] = ` }" > @@ -161,7 +161,7 @@ exports[`Header opening the Privacy Policy modal while holding ctrl key 1`] = ` }" > @@ -237,7 +237,7 @@ exports[`Header opening the Privacy Policy modal while holding meta key 1`] = ` }" > @@ -313,7 +313,7 @@ exports[`Header opening the Privacy Policy modal while holding shift key 1`] = ` }" > @@ -389,7 +389,7 @@ exports[`Header rendering 1`] = ` }" > @@ -466,7 +466,7 @@ exports[`Header rendering with no banner 1`] = ` }" > diff --git a/src/components/PrivacyPolicy/index.js b/src/components/PrivacyPolicy/index.js index e2641e6..6bf5148 100644 --- a/src/components/PrivacyPolicy/index.js +++ b/src/components/PrivacyPolicy/index.js @@ -1,11 +1,12 @@ import React from 'react'; -import PropTypes from 'prop-types'; -import { withTranslation, Trans } from 'react-i18next'; +import { useTranslation, Trans } from 'react-i18next'; import Message from 'components/Message'; -export const PrivacyPolicy = ({ t, ...props }) => ( - +export const PrivacyPolicy = props => { + const { t } = useTranslation(); + + return

Regexper and the tools used to create it are all open source. If you are @@ -44,11 +45,7 @@ export const PrivacyPolicy = ({ t, ...props }) => ( Regexper is not supported by ad revenue or sales of any kind.

-
-); - -PrivacyPolicy.propTypes = { - t: PropTypes.func.isRequired +
; }; -export default withTranslation()(PrivacyPolicy); +export default PrivacyPolicy; diff --git a/src/components/PrivacyPolicy/test.js b/src/components/PrivacyPolicy/test.js index 3a1c4b3..a7d8aea 100644 --- a/src/components/PrivacyPolicy/test.js +++ b/src/components/PrivacyPolicy/test.js @@ -4,13 +4,12 @@ jest.mock('components/Message', () => import React from 'react'; import { render } from 'react-testing-library'; -import { mockT } from 'i18n'; -import { PrivacyPolicy } from 'components/PrivacyPolicy'; +import PrivacyPolicy from 'components/PrivacyPolicy'; describe('PrivacyPolicy', () => { test('rendering', () => { const { asFragment } = render( - + ); expect(asFragment()).toMatchSnapshot(); }); diff --git a/src/pages/__snapshots__/privacy.test.js.snap b/src/pages/__snapshots__/privacy.test.js.snap index 89832ae..e1cd9a4 100644 --- a/src/pages/__snapshots__/privacy.test.js.snap +++ b/src/pages/__snapshots__/privacy.test.js.snap @@ -9,7 +9,7 @@ exports[`Privacy Page rendering 1`] = ` }" />