Files
supabase/apps/studio/components/interfaces/DiskManagement/ui/BillingChangeBadge.tsx
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00

70 lines
2.3 KiB
TypeScript

import { ChevronRightIcon } from 'lucide-react'
import { AnimatePresence, motion } from 'motion/react'
import { Badge, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import { formatCurrency } from '@/lib/helpers'
interface BillingChangeBadgeProps {
beforePrice?: number
afterPrice?: number
show: boolean | undefined
tooltip?: string
className?: string
free?: boolean
}
export const BillingChangeBadge = ({
beforePrice,
afterPrice,
show,
tooltip,
className,
free,
}: BillingChangeBadgeProps) => {
return (
<AnimatePresence>
{beforePrice !== undefined && afterPrice !== undefined && show && (
<motion.div
initial={{ opacity: 0, x: -4, height: 0 }}
animate={{ opacity: 1, x: 0, height: 'auto' }}
exit={{ opacity: 0, x: -4, height: 0 }}
transition={{ type: 'spring', stiffness: 800, damping: 40, duration: 0.3 }}
>
<Badge
variant="default"
className={cn(
free ? `bg-violet-200 border-violet-900` : 'bg-alternative',
`text-warning`,
className
)}
>
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center gap-1">
<span className="text-xs font-mono text-foreground-muted" translate="no">
{formatCurrency(beforePrice)}
</span>
<ChevronRightIcon size={12} strokeWidth={2} className="text-foreground-muted" />
<motion.span
key={afterPrice} // This key will change whenever any form value changes
className={cn(
free ? 'text-violet-1100' : 'text-foreground',
'text-xs font-mono'
)}
animate={{ scale: [1, 1.1, 1] }}
transition={{ duration: 0.12 }}
translate="no"
>
{`${formatCurrency(afterPrice)}/month`}
</motion.span>
</div>
</TooltipTrigger>
{tooltip !== undefined && <TooltipContent side="bottom">{tooltip}</TooltipContent>}
</Tooltip>
</Badge>
</motion.div>
)}
</AnimatePresence>
)
}