From 8733795c8449f3514369d7b4220934760e386f1b Mon Sep 17 00:00:00 2001 From: Biswa Kalyan Bhuyan Date: Fri, 25 Apr 2025 01:09:30 +0530 Subject: finance/frontend: fix: did some minor changes to the frontend --- frontend/src/components/shared/Notification.tsx | 58 +++++++++++++++---------- 1 file changed, 34 insertions(+), 24 deletions(-) (limited to 'frontend/src/components/shared/Notification.tsx') diff --git a/frontend/src/components/shared/Notification.tsx b/frontend/src/components/shared/Notification.tsx index bcc11c4..68cbc7a 100644 --- a/frontend/src/components/shared/Notification.tsx +++ b/frontend/src/components/shared/Notification.tsx @@ -1,11 +1,29 @@ 'use client'; import { useEffect, useState } from 'react'; -import { CheckCircle, AlertCircle, X } from 'lucide-react'; +import { CheckCircle, AlertCircle, Info, X } from 'lucide-react'; +import { cva, type VariantProps } from 'class-variance-authority'; +import { cn } from '@/lib/utils'; export type NotificationType = 'success' | 'error' | 'info'; -interface NotificationProps { +const notificationVariants = cva( + "fixed z-50 top-4 right-4 flex items-center gap-3 p-4 rounded-lg shadow-lg border max-w-sm transition-all duration-300 animate-in fade-in slide-in-from-top-5", + { + variants: { + variant: { + success: "bg-background border-border text-foreground", + error: "bg-background border-border text-foreground", + info: "bg-background border-border text-foreground", + } + }, + defaultVariants: { + variant: "info", + }, + } +); + +interface NotificationProps extends VariantProps { type: NotificationType; message: string; duration?: number; @@ -41,38 +59,30 @@ export function Notification({ const getIcon = () => { switch (type) { case 'success': - return ; + return ; case 'error': - return ; + return ; case 'info': - return ; + return ; default: return null; } }; - const getContainerClasses = () => { - const baseClasses = 'fixed top-4 right-4 z-50 flex items-center gap-3 rounded-lg p-4 shadow-md max-w-sm'; - - switch (type) { - case 'success': - return `${baseClasses} bg-green-50 text-green-800 border border-green-200`; - case 'error': - return `${baseClasses} bg-red-50 text-red-800 border border-red-200`; - case 'info': - return `${baseClasses} bg-blue-50 text-blue-800 border border-blue-200`; - default: - return baseClasses; - } - }; - return ( -
- {getIcon()} -
{message}
+
+
+ {getIcon()} +
+
{message}