Updating PrivacyPolicy to use hooks
This commit is contained in:
parent
c6020a225f
commit
f9b3d5dbd7
@ -9,7 +9,7 @@ exports[`Header opening the Privacy Policy modal 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -85,7 +85,7 @@ exports[`Header opening the Privacy Policy modal while holding alt key 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -161,7 +161,7 @@ exports[`Header opening the Privacy Policy modal while holding ctrl key 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -237,7 +237,7 @@ exports[`Header opening the Privacy Policy modal while holding meta key 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -313,7 +313,7 @@ exports[`Header opening the Privacy Policy modal while holding shift key 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -389,7 +389,7 @@ exports[`Header rendering 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@ -466,7 +466,7 @@ exports[`Header rendering with no banner 1`] = `
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import { useTranslation, Trans } from 'react-i18next';
|
||||||
import { withTranslation, Trans } from 'react-i18next';
|
|
||||||
|
|
||||||
import Message from 'components/Message';
|
import Message from 'components/Message';
|
||||||
|
|
||||||
export const PrivacyPolicy = ({ t, ...props }) => (
|
export const PrivacyPolicy = props => {
|
||||||
<Message type="info" heading={ t('Privacy Policy') } { ...props }>
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return <Message type="info" heading={ t('Privacy Policy') } { ...props }>
|
||||||
<Trans i18nKey="Privacy policy copy">
|
<Trans i18nKey="Privacy policy copy">
|
||||||
<p>
|
<p>
|
||||||
Regexper and the tools used to create it are all open source. If you are
|
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.
|
Regexper is not supported by ad revenue or sales of any kind.
|
||||||
</p>
|
</p>
|
||||||
</Trans>
|
</Trans>
|
||||||
</Message>
|
</Message>;
|
||||||
);
|
|
||||||
|
|
||||||
PrivacyPolicy.propTypes = {
|
|
||||||
t: PropTypes.func.isRequired
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withTranslation()(PrivacyPolicy);
|
export default PrivacyPolicy;
|
||||||
|
@ -4,13 +4,12 @@ jest.mock('components/Message', () =>
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render } from 'react-testing-library';
|
import { render } from 'react-testing-library';
|
||||||
|
|
||||||
import { mockT } from 'i18n';
|
import PrivacyPolicy from 'components/PrivacyPolicy';
|
||||||
import { PrivacyPolicy } from 'components/PrivacyPolicy';
|
|
||||||
|
|
||||||
describe('PrivacyPolicy', () => {
|
describe('PrivacyPolicy', () => {
|
||||||
test('rendering', () => {
|
test('rendering', () => {
|
||||||
const { asFragment } = render(
|
const { asFragment } = render(
|
||||||
<PrivacyPolicy onClose={ jest.fn() } t={ mockT } />
|
<PrivacyPolicy onClose={ jest.fn() } />
|
||||||
);
|
);
|
||||||
expect(asFragment()).toMatchSnapshot();
|
expect(asFragment()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ exports[`Privacy Page rendering 1`] = `
|
|||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
data-component="withI18nextTranslation(PrivacyPolicy)"
|
data-component="PrivacyPolicy"
|
||||||
data-props="{}"
|
data-props="{}"
|
||||||
/>
|
/>
|
||||||
</DocumentFragment>
|
</DocumentFragment>
|
||||||
|
Loading…
Reference in New Issue
Block a user