Skip to content

Commit

Permalink
Merge pull request #1483 from AletheiaFact/refactoring-banner-logic
Browse files Browse the repository at this point in the history
Refactoring banner logic
  • Loading branch information
thesocialdev authored Dec 3, 2024
2 parents 6f85518 + ae0f0e9 commit 2c47e3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/components/Home/DonationBanner.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const DonationBannerStyle = styled(Col)`
align-self: flex-end;
position: absolute;
right: 10px;
top: -10px;
bottom: -10px;
z-index: 1;
}
Expand Down Expand Up @@ -64,6 +64,11 @@ const DonationBannerStyle = styled(Col)`
.banner-content > p {
font-size: 12px;
}
.close-banner {
align-self: flex-start;
top: -10px;
}
}
`;

Expand Down
10 changes: 5 additions & 5 deletions src/components/Home/DonationBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const closeBanner = (onClose) => {

const DonationBanner = () => {
const enableDonationBanner = process.env.NEXT_PUBLIC_ENABLE_BANNER_DONATION === "true";
const [showDonationBanner, setDonationBanner] = useState<boolean>(true);
const [showDonationBanner, setDonationBanner] = useState<boolean>(false);

useEffect(() => {
const BannerCookies = Cookies.get("cta_donation_banner_show") || true;
if (BannerCookies === true || BannerCookies === "true") {
return setDonationBanner(true);
const CloseBannerCookies = Cookies.get("cta_donation_banner_show");
if (CloseBannerCookies) {
return setDonationBanner(false);
}
setDonationBanner(false);
setDonationBanner(true);
}, []);

if (!enableDonationBanner) {
Expand Down

0 comments on commit 2c47e3c

Please sign in to comment.