Skip to content

Commit

Permalink
feat: add button to reconfigure cookie consent
Browse files Browse the repository at this point in the history
  • Loading branch information
virus-rpi committed Nov 21, 2024
1 parent 47c842e commit 424299e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/assets/locales/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@
"image.attribution": "Foto von ",
"iframemanager.youtube.notice": "Dieser Inhalt wird von einer externen Quelle gehostet. Durch das Laden des Inhalts akzeptieren Sie die <a rel=\"noreferrer noopener\" href=\"https://www.youtube.com/t/terms\" target=\"_blank\">Nutzungsbedingungen</a> von youtube.com und stimmen einer möglichen Übertragung Ihrer Daten in Drittländer zu.",
"iframemanager.youtube.load-button": "Inhalt laden",
"iframemanager.youtube.load-all-button": "Inhalt laden und nicht mehr fragen"
"iframemanager.youtube.load-all-button": "Inhalt laden und nicht mehr fragen",
"dataprivacy.reopen-cookie-consent": "Cookie-Einstellungen erneut öffnen"
}
3 changes: 2 additions & 1 deletion src/assets/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@
"image.attribution": "Photo by ",
"iframemanager.youtube.notice": "This content is hosted by a third party. By showing the external content you accept the <a rel=\"noreferrer noopener\" href=\"https://www.youtube.com/t/terms\" target=\"_blank\">terms and conditions</a> of youtube.com and agree to a possible transfer of your data to third countries.",
"iframemanager.youtube.load-button": "Load content",
"iframemanager.youtube.load-all-button": "Load content and don't ask again"
"iframemanager.youtube.load-all-button": "Load content and don't ask again",
"dataprivacy.reopen-cookie-consent": "Reopen cookie consent preferences"
}
14 changes: 14 additions & 0 deletions src/pages/data-privacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Layout } from '../components/layout/layout';
import { ContentBlockContainer } from '../components/layout/content-block-container';
import { ContentfulRichText } from '../components/content/rich-text/rich-text';
import { ContentfulPage, ContentfulRichTextType } from '../types';
import * as CookieConsentLib from 'vanilla-cookieconsent';
import { Button } from '../components/ui/buttons/button';
import { useTranslation } from 'react-i18next';

interface DataPrivacyPageQueryProps {
contentfulPage: ContentfulPage;
Expand All @@ -14,9 +17,20 @@ interface DataPrivacyPageQueryProps {
const DataPrivacyPage = ({
data,
}: PageProps<DataPrivacyPageQueryProps>): JSX.Element => {
const { t } = useTranslation();

const reopenCookieConsent = () => {
if (CookieConsentLib && CookieConsentLib.showPreferences) {
CookieConsentLib.showPreferences();
}
};

return (
<Layout light={true}>
<ContentBlockContainer>
<Button onClick={reopenCookieConsent}>
{t('dataprivacy.reopen-cookie-consent')}
</Button>
<ContentfulRichText
data={data.contentfulPage.content as ContentfulRichTextType}
/>
Expand Down

0 comments on commit 424299e

Please sign in to comment.