-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support customized privacy policy and terms of use URLs
- Loading branch information
Showing
6 changed files
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { render } from '@testing-library/react'; | ||
import { PrivacyPolicyLink, TermsOfUseLink } from './Links'; | ||
|
||
describe('PrivacyPolicyLink', () => { | ||
it('uses the link from an environment variable', () => { | ||
process.env.PRIVACY_POLICY_URL = 'privacy-policy.com'; | ||
|
||
const { getByRole } = render(<PrivacyPolicyLink />); | ||
expect(getByRole('link')).toHaveAttribute('href', 'privacy-policy.com'); | ||
}); | ||
}); | ||
|
||
describe('TermsOfUseLink', () => { | ||
it('uses the link from an environment variable', () => { | ||
process.env.TERMS_OF_USE_URL = 'terms-of-use.com'; | ||
|
||
const { getByRole } = render(<TermsOfUseLink />); | ||
expect(getByRole('link')).toHaveAttribute('href', 'terms-of-use.com'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Link, LinkProps } from '@mui/material'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export const PrivacyPolicyLink: React.FC<LinkProps> = (props) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Link href={process.env.PRIVACY_POLICY_URL} target="_blank" {...props}> | ||
{t('Privacy Policy')} | ||
</Link> | ||
); | ||
}; | ||
|
||
export const TermsOfUseLink: React.FC<LinkProps> = (props) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Link href={process.env.TERMS_OF_USE_URL} target="_blank" {...props}> | ||
{t('Terms of Use')} | ||
</Link> | ||
); | ||
}; |