Skip to content

Commit

Permalink
Update AnnouncementHero.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
IITI-tushar authored Dec 28, 2024
1 parent 7e7a052 commit 7f075ec
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions components/campaigns/AnnouncementHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn
<div className='relative flex min-h-72 w-full items-center justify-center overflow-hidden lg:h-[17rem] lg:w-[38rem]'>
{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 (
<Banner
key={index}
Expand All @@ -89,9 +90,7 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn
<div
key={index}
className={`mx-1 size-2 cursor-pointer rounded-full ${
activeIndex % numberOfVisibleBanners === index
? 'bg-primary-500'
: 'bg-gray-300'
activeIndex % numberOfVisibleBanners === index ? 'bg-primary-500' : 'bg-gray-300'
}`}
onClick={() => goToIndex(index)}
/>
Expand Down

0 comments on commit 7f075ec

Please sign in to comment.