Skip to content

Commit 49b088f

Browse files
authored
Merge pull request #354 from dataforgoodfr/feat/donation_banner
Feat/donation banner
2 parents 5bd6acd + c6ab102 commit 49b088f

6 files changed

Lines changed: 981 additions & 3 deletions

File tree

frontend/messages/fr/layout.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
"layout": {
33
"header": {
44
"title": "Data For Good, accueil",
5+
"banner": {
6+
"top": {
7+
"desktopText": "Campagne de dons en cours",
8+
"mobileText":"Campagne de dons en cours",
9+
"cta": "Participer"
10+
}
11+
},
512
"nav": {
613
"toggle": {
714
"alt": "Principale",

frontend/public/images/confettis-banner.svg

Lines changed: 910 additions & 0 deletions
Loading

frontend/src/app/[locale]/_partials/header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ const Header = () => {
145145

146146
return (
147147
<header className={clsx(
148-
"fixed top-0 left-0 w-full z-50 transition-colors duration-300",
148+
"sticky top-0 left-0 w-full z-50 transition-colors duration-300",
149149
isScrolled && "bg-white"
150150
)}>
151151
<nav
@@ -215,7 +215,7 @@ const Header = () => {
215215
<ul
216216
role="menu"
217217
aria-label={t('header.nav.top.label')}
218-
className="flex flex-col lg:flex-row gap-4 lg:gap-2 p-4 lg:p-0"
218+
className="inline-flex lg:flex flex-col lg:flex-row gap-4 lg:gap-2 p-4 lg:p-0"
219219
onKeyDown={handleFocusNav}
220220
>
221221
{Object.keys(topNav).map(link => (

frontend/src/app/[locale]/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { routing } from '@/i18n/routing';
88
import Footer from './_partials/footer';
99
import Header from './_partials/header';
1010
import './globals.css';
11-
import { NewsletterBlock } from '@/components';
11+
import { CampaignBanner, NewsletterBlock } from '@/components';
1212

1313
const dmMono = DM_Mono({
1414
subsets: ['latin'],
@@ -87,6 +87,7 @@ export default async function RootLayout({
8787
style={{ backgroundSize: '100vw 100vh' }}
8888
>
8989
<NextIntlClientProvider>
90+
<CampaignBanner/>
9091
<Header />
9192
<main className="flex-1">
9293
{children}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { ArrowIcon, Button } from '@/components/atoms';
2+
import { usePathLocale } from '@/hooks/usePathLocale';
3+
import clsx from 'clsx';
4+
import { useTranslations } from 'next-intl';
5+
import Image from "next/image"
6+
import Link from 'next/link';
7+
8+
export type CampaignBannerProps = {
9+
className?: string;
10+
};
11+
12+
const CampaignBanner: React.FC<CampaignBannerProps> = ({
13+
className,
14+
...props
15+
}) => {
16+
const t = useTranslations('layout');
17+
const cta_link = usePathLocale('/donations')
18+
19+
return (
20+
<div
21+
className={clsx(
22+
'relative justify-center items-center text-white bg-building',
23+
className,
24+
)}
25+
{...props}
26+
>
27+
<Image
28+
src="/images/confettis-banner.svg"
29+
alt=""
30+
width={1000}
31+
height={1000}
32+
loading="lazy"
33+
className="absolute top-0 left-0 w-full h-full opacity-90 object-cover z-1"
34+
/>
35+
<div className="w-full relative lg:justify-start justify-between flex flex-row w-full z-2 pl-6 pr-2 md:pr-6 py-4 lg:py-2 text-left items-center lead">
36+
<p className='uppercase text-sm font-black max-md:hidden'>{t(`header.banner.top.desktopText`)}</p>
37+
<p className='uppercase text-sm font-black md:hidden'>{t(`header.banner.top.mobileText`)}</p>
38+
<Link
39+
href={cta_link}
40+
data-ref={cta_link}
41+
className={clsx(
42+
'flex items-center z-10 gap-2 ml-5 px-4 py-0.5',
43+
'bg-white',
44+
'font-primary font-black tracking-widest uppercase text-black text-xs shadow-base',
45+
)}
46+
>
47+
<span>{t(`header.banner.top.cta`)}</span>
48+
<ArrowIcon />
49+
</Link>
50+
51+
52+
</div>
53+
</div>
54+
);
55+
};
56+
57+
export default CampaignBanner;

frontend/src/components/molecules/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ export type { BannerVideoProps } from './BannerVideo/BannerVideo';
4949

5050
export { default as LargeTextImageDonation } from './LargeTextImageDonation/LargeTextImageDonation';
5151
export type { LargeTextImageDonationProps } from './LargeTextImageDonation/LargeTextImageDonation';
52+
53+
export { default as CampaignBanner } from './CampaignBanner/CampaignBanner';
54+
export type { CampaignBannerProps } from './CampaignBanner/CampaignBanner';

0 commit comments

Comments
 (0)