From f13cfcaf8cc507ac3cf037081dce04b0e05612a7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 26 Jul 2022 11:37:02 -0500 Subject: [PATCH] GdprBanner: slideout on accept --- app/soapbox/components/gdpr-banner.tsx | 7 +++++-- app/soapbox/components/ui/banner/banner.tsx | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/soapbox/components/gdpr-banner.tsx b/app/soapbox/components/gdpr-banner.tsx index 14eed7b9c..cda7b0179 100644 --- a/app/soapbox/components/gdpr-banner.tsx +++ b/app/soapbox/components/gdpr-banner.tsx @@ -1,3 +1,4 @@ +import classNames from 'classnames'; import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; @@ -10,6 +11,7 @@ const acceptedGdpr = !!localStorage.getItem('soapbox:gdpr'); const GdprBanner: React.FC = () => { /** Track whether the banner has already been displayed once. */ const [shown, setShown] = useState(acceptedGdpr); + const [slideout, setSlideout] = useState(false); const soapbox = useSoapboxConfig(); const isLoggedIn = useAppSelector(state => !!state.me); @@ -17,7 +19,8 @@ const GdprBanner: React.FC = () => { const handleAccept = () => { localStorage.setItem('soapbox:gdpr', 'true'); - setShown(true); + setSlideout(true); + setTimeout(() => setShown(true), 200); }; const showBanner = soapbox.gdpr && !isLoggedIn && !shown; @@ -27,7 +30,7 @@ const GdprBanner: React.FC = () => { } return ( - + diff --git a/app/soapbox/components/ui/banner/banner.tsx b/app/soapbox/components/ui/banner/banner.tsx index 3b2453a4a..8e62cfe2c 100644 --- a/app/soapbox/components/ui/banner/banner.tsx +++ b/app/soapbox/components/ui/banner/banner.tsx @@ -4,17 +4,18 @@ import React from 'react'; interface IBanner { theme: 'frosted' | 'opaque', children: React.ReactNode, + className?: string, } /** Displays a sticky full-width banner at the bottom of the screen. */ -const Banner: React.FC = ({ theme, children }) => { +const Banner: React.FC = ({ theme, children, className }) => { return (