From 63b154c5b90fdf6ba5797f9bd0c41d998ea2db65 Mon Sep 17 00:00:00 2001 From: IITI-tushar <019saxenatushar@gmail.com> Date: Sat, 28 Dec 2024 11:24:17 +0530 Subject: [PATCH 1/3] updated AnnouncementHero.tsx --- components/campaigns/AnnouncementHero.tsx | 54 +++++++++++++---------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index bee864e495c6..1da3aa0dce72 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -49,41 +49,49 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn } return ( - -
+ +
{numberOfVisibleBanners > 1 && (
- +
)} -
-
- {visibleBanners.map((banner, index) => ( - - ))} +
+
+ {visibleBanners.map((banner, index) => { + // Only render active banner and immediate neighbors + const isVisible = + Math.abs(index - (activeIndex % numberOfVisibleBanners)) <= 1; + if (!isVisible) return null; + return ( + + ); + })}
-
+
{visibleBanners.map((banner, index) => (
goToIndex(index)} /> @@ -96,7 +104,7 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn rounded-full bg-primary-500 opacity-50 hover:bg-primary-600 md:opacity-100`} onClick={goToNext} > - +
)}
From 7e7a0525071ba405db6c18bb39c90047e401532e Mon Sep 17 00:00:00 2001 From: IITI-tushar <165766280+IITI-tushar@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:30:27 +0530 Subject: [PATCH 2/3] Update AnnouncementHero.tsx --- components/campaigns/AnnouncementHero.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index 1da3aa0dce72..9000556fbe10 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -49,19 +49,19 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn } return ( - -
+ +
{numberOfVisibleBanners > 1 && (
- +
)} -
-
+
+
{visibleBanners.map((banner, index) => { // Only render active banner and immediate neighbors const isVisible = @@ -84,7 +84,7 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn ); })}
-
+
{visibleBanners.map((banner, index) => (
- +
)}
From 7f075ec179acf7f77b867dd70bde194233673088 Mon Sep 17 00:00:00 2001 From: IITI-tushar <165766280+IITI-tushar@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:56:38 +0530 Subject: [PATCH 3/3] Update AnnouncementHero.tsx --- components/campaigns/AnnouncementHero.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index 9000556fbe10..80931437f0f9 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -64,9 +64,10 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn
{visibleBanners.map((banner, index) => { // Only render active banner and immediate neighbors - const isVisible = - Math.abs(index - (activeIndex % numberOfVisibleBanners)) <= 1; + const isVisible = Math.abs(index - (activeIndex % numberOfVisibleBanners)) <= 1; + if (!isVisible) return null; + return ( goToIndex(index)} />