import clsx from 'clsx'; import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { Banner, Button, HStack, Stack, Text } from 'soapbox/components/ui'; import { useInstance, useSoapboxConfig } from 'soapbox/hooks'; const acceptedGdpr = !!localStorage.getItem('plfe:gdpr'); /** Displays a cookie consent banner. */ const GdprBanner: React.FC = () => { /** Track whether the banner has already been displayed once. */ const [shown, setShown] = useState(acceptedGdpr); const [slideout, setSlideout] = useState(false); const instance = useInstance(); const { gdprUrl } = useSoapboxConfig(); const handleAccept = () => { localStorage.setItem('plfe:gdpr', 'true'); setSlideout(true); setTimeout(() => setShown(true), 200); }; if (shown) { return null; } return (
{gdprUrl && ( )}
); }; export { GdprBanner as default };