Skip to content
Closed
19 changes: 16 additions & 3 deletions src/components/Home/HomeCarouselCTA/CarouselCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface CarouselCTAProps {
iconContainerClassName?: string
// Notification-specific props
isPermissionDenied?: boolean
secondaryIcon?: StaticImageData | string
}

const CarouselCTA = ({
Expand All @@ -30,6 +31,7 @@ const CarouselCTA = ({
logo,
iconContainerClassName,
isPermissionDenied,
secondaryIcon,
}: CarouselCTAProps) => {
const [showPermissionDeniedModal, setShowPermissionDeniedModal] = useState(false)

Expand Down Expand Up @@ -87,15 +89,26 @@ const CarouselCTA = ({
{/* Icon container */}
<div
className={twMerge(
'flex size-8 items-center justify-center rounded-full',
'relative flex size-9 items-center justify-center rounded-full',
logo ? 'bg-transparent' : 'bg-primary-1',
iconContainerClassName
)}
>
{/* Show icon only if logo isn't provided. Logo takes precedence over icon. */}
{!logo && <Icon name={icon} size={20} />}
{!logo && <Icon name={icon} size={22} />}
{logo && (
<Image src={logo} alt={typeof title === 'string' ? title : 'logo'} width={32} height={32} />
<Image src={logo} alt={typeof title === 'string' ? title : 'logo'} width={36} height={36} />
)}

{secondaryIcon && (
<Image
src={typeof secondaryIcon === 'string' ? secondaryIcon : secondaryIcon.src}
alt="secondary icon"
height={64}
width={64}
quality={100}
className="absolute -right-1 bottom-0 z-50 size-4 rounded-full object-cover"
/>
)}
</div>

Expand Down
1 change: 1 addition & 0 deletions src/components/Home/HomeCarouselCTA/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const HomeCarouselCTA = () => {
logo={cta.logo}
iconContainerClassName={cta.iconContainerClassName}
isPermissionDenied={cta.isPermissionDenied}
secondaryIcon={cta.secondaryIcon}
/>
))}
</Carousel>
Expand Down
15 changes: 15 additions & 0 deletions src/hooks/useHomeCarouselCTAs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useNotifications } from './useNotifications'
import { useRouter } from 'next/navigation'
import useKycStatus from './useKycStatus'
import type { StaticImageData } from 'next/image'
import { PIX } from '@/assets'

export type CarouselCTA = {
id: string
Expand All @@ -19,6 +20,7 @@ export type CarouselCTA = {
onClose?: () => void
isPermissionDenied?: boolean
iconContainerClassName?: string
secondaryIcon?: StaticImageData | string
}

export const useHomeCarouselCTAs = () => {
Expand All @@ -32,6 +34,19 @@ export const useHomeCarouselCTAs = () => {
const generateCarouselCTAs = useCallback(() => {
const _carouselCTAs: CarouselCTA[] = []

_carouselCTAs.push({
id: 'merchant-map-pix',
title: '20% Off with PIX Payments',
description: 'Click to explore participating merchants. Pay with PIX QR, save instantly, earn points.',
iconContainerClassName: 'bg-secondary-1',
icon: 'shield',
onClick: () => {
router.push('https://peanutprotocol.notion.site/Peanut-Foodie-Guide-29a83811757980e79896f2a610d6591a')
},
logo: PIX,
secondaryIcon: 'https://flagcdn.com/w320/br.png',
})

// add notification prompt as first item if it should be shown
if (showReminderBanner) {
_carouselCTAs.push({
Expand Down
Loading