Skip to content

Commit 8e486c3

Browse files
authored
Merge pull request #1302 from peanutprotocol/fix/carousel-not-clickable
fix: Home carousel not clickable
2 parents 324fd93 + 816b645 commit 8e486c3

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/components/Home/HomeBanners/BannerCard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ interface BannerCardProps {
99
title: string
1010
description: string
1111
onClose: () => void
12+
onClick?: () => void
1213
}
1314

14-
const BannerCard = ({ title, description, icon, onClose }: BannerCardProps) => {
15+
const BannerCard = ({ title, description, icon, onClose, onClick }: BannerCardProps) => {
1516
const handleClose = (e: React.MouseEvent) => {
1617
e.stopPropagation()
1718
onClose()
1819
}
1920

2021
return (
21-
<Card className="embla__slide relative flex flex-row items-center justify-around p-2">
22+
<Card onClick={onClick} className="embla__slide relative flex flex-row items-center justify-around p-2">
2223
<div className="absolute right-2 top-2">
2324
<Icon onClick={handleClose} name="cancel" size={10} />
2425
</div>

src/components/Home/HomeBanners/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const HomeBanners = () => {
3838
onClose={() => {
3939
setBanners(banners.filter((b) => b.id !== banner.id))
4040
}}
41+
onClick={banner.onClick}
4142
/>
4243
)
4344
})}

src/hooks/useBanners.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IconName } from '@/components/Global/Icons/Icon'
44
import { useAuth } from '@/context/authContext'
55
import { useEffect, useState } from 'react'
66
import { useNotifications } from './useNotifications'
7+
import { useRouter } from 'next/navigation'
78

89
export type Banner = {
910
id: string
@@ -21,6 +22,7 @@ export const useBanners = () => {
2122
const { user } = useAuth()
2223
const { showReminderBanner, requestPermission, snoozeReminderBanner, afterPermissionAttempt, isPermissionDenied } =
2324
useNotifications()
25+
const router = useRouter()
2426

2527
const generateBanners = () => {
2628
const _banners: Banner[] = []
@@ -50,6 +52,9 @@ export const useBanners = () => {
5052
title: 'Unlock bank & local payments',
5153
description: 'Complete verification to add, withdraw or pay using Mercado Pago.',
5254
icon: 'shield',
55+
onClick: () => {
56+
router.push('/profile/identity-verification')
57+
},
5358
})
5459
}
5560

0 commit comments

Comments
 (0)