Skip to content

Commit

Permalink
fixed AnnouncementHero component
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatnema committed Oct 23, 2024
1 parent bef2e01 commit 7ad3ff6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/campaigns/AnnouncementHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ interface IAnnouncementHeroProps {
export default function AnnouncementHero({ className = '', small = false }: IAnnouncementHeroProps) {
const [activeIndex, setActiveIndex] = useState(0);

const len = banners.length;
const visibleBanners = useMemo(() => banners.filter((banner) => shouldShowBanner(banner.cfpDeadline)), [banners]);
const numberOfVisibleBanners = visibleBanners.length;

Expand Down Expand Up @@ -80,11 +79,11 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn
))}
</div>
<div className='m-auto flex justify-center'>
{banners.map((banner, index) => (
{visibleBanners.map((banner, index) => (
<div
key={index}
className={`mx-1 size-2 cursor-pointer rounded-full ${
activeIndex % len === 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 7ad3ff6

Please sign in to comment.