-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1474 from AletheiaFact/Latest-changes-donation-ba…
…nner-December Latest changes to donation banner december
- Loading branch information
Showing
6 changed files
with
106 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"title": "AletheiaFact {{date}} Donation Campaign", | ||
"paragraph": "AletheiaFact.org works to combat misinformation and strengthen fact-checking. With your donation, you support the movement against FAKE NEWS, ensuring reliable information reaches you.", | ||
"donateButton": "Donate to aletheia", | ||
"showButton": "Show", | ||
"hideButton": "Hide" | ||
|
||
"title": "AletheiaFact.org needs you to survive", | ||
"paragraph": "AletheiaFact.org is unique and relies on the community. No ads, no subscriptions, we are driven by the passion to ensure free and reliable access to information. With your help, we continue to be a trusted reference. <strong>Our strength lies in the community – and that includes you.</strong> Today, we ask you to support us in this commitment to the truth. Show Brazil that reliable and impartial information is essential and that you stand with us in this mission. <strong>Donate now and help strengthen the fight against misinformation.</strong> Even a small donation makes a big difference. This is the time to act so that together, we can promote more democratic journalism and fight misinformation. <strong>Thank you for believing in AletheiaFact.org.</strong>", | ||
"yesDonateButton": "I want to contribute!", | ||
"noDonateButton": "I don't want to donate" | ||
} |
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"title": "Campanha doação AletheiaFact {{date}}", | ||
"paragraph": "A AletheiaFact.org trabalha para combater a desinformação e fortalecer a checagem de fatos. Com sua doação, você apoia o movimento contra FAKE NEWS e informações confiáveis cheguem a você.", | ||
"donateButton": "Doe para aletheia", | ||
"showButton": "Mostrar", | ||
"hideButton": "Ocultar" | ||
|
||
"title": "A AletheiaFact.org precisa de você para sobreviver", | ||
"paragraph": "A AletheiaFact.org é única e depende da comunidade. Sem anúncios, sem assinaturas, somos movidos pela paixão de garantir acesso livre e confiável à informação. Com sua ajuda, continuamos sendo um referencial de confiança. <strong>Nossa força está na comunidade – e isso inclui você.</strong> Hoje, pedimos que nos apoie nesse compromisso com a verdade. Mostre ao Brasil que informações confiáveis e imparciais são essenciais e que você está ao nosso lado nessa missão. <strong>Doe agora e ajude a fortalecer o combate à desinformação.</strong> Mesmo uma doação pequena faz uma grande diferença. Este é o momento de agir para que, juntos, possamos promover um jornalismo mais democrático e combater a desinformação. <strong>Obrigado por acreditar na AletheiaFact.org.</strong>", | ||
"yesDonateButton": "Quero contribuir!", | ||
"noDonateButton": "Não quero doar" | ||
} |
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 |
---|---|---|
@@ -1,33 +1,44 @@ | ||
import React, { useState } from "react"; | ||
import React, { useEffect, useState } from "react"; | ||
import DonationBannerContent from "./DonationBanner/DonationBannerContent"; | ||
import DonationBannerStyle from "./DonationBanner.style"; | ||
import { Col } from "antd"; | ||
import { useTranslation } from "next-i18next"; | ||
import Cookies from "js-cookie"; | ||
import CloseOutlined from "@mui/icons-material/CloseOutlined"; | ||
|
||
const closeBanner = (onClose) => { | ||
onClose(); | ||
Cookies.set("cta_donation_banner_show", "false"); | ||
}; | ||
|
||
const DonationBanner = () => { | ||
const { t } = useTranslation(); | ||
const [isBannerVisible, setIsBannerVisible] = useState(true); | ||
const enableDonationBanner = process.env.NEXT_PUBLIC_ENABLE_BANNER_DONATION === "true"; | ||
const handleToggleBanner = () => { | ||
setIsBannerVisible((prev) => !prev); | ||
} | ||
const [showDonationBanner, setDonationBanner] = useState<boolean>(true); | ||
|
||
useEffect(() => { | ||
const BannerCookies = Cookies.get("cta_donation_banner_show") || true; | ||
if (BannerCookies === true || BannerCookies === "true") { | ||
return setDonationBanner(true); | ||
} | ||
setDonationBanner(false); | ||
}, []); | ||
|
||
if (!enableDonationBanner){ | ||
if (!enableDonationBanner) { | ||
return null | ||
}; | ||
|
||
return ( | ||
return showDonationBanner && ( | ||
<DonationBannerStyle> | ||
<Col className="banner-container"> | ||
{isBannerVisible && <DonationBannerContent />} | ||
<button | ||
className="show-banner" | ||
onClick={handleToggleBanner}> | ||
{isBannerVisible ? t("donationBanner:hideButton") : t("donationBanner:showButton")} | ||
</button> | ||
<CloseOutlined | ||
className="close-banner" | ||
onClick={() => closeBanner(() => setDonationBanner(false))} | ||
/> | ||
<DonationBannerContent | ||
closeClick={() => closeBanner(() => setDonationBanner(false))} | ||
/> | ||
</Col> | ||
</DonationBannerStyle > | ||
); | ||
</DonationBannerStyle> | ||
) | ||
}; | ||
|
||
export default DonationBanner; |
25 changes: 19 additions & 6 deletions
25
src/components/Home/DonationBanner/DonationBannerButton.tsx
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