diff --git a/src/components/dashboard/universal/CustomAlert.tsx b/src/components/dashboard/universal/CustomAlert.tsx new file mode 100644 index 0000000..b8302e4 --- /dev/null +++ b/src/components/dashboard/universal/CustomAlert.tsx @@ -0,0 +1,126 @@ +import React from 'react'; +import { Icon } from "@iconify/react"; + +export type AlertType = 'info' | 'success' | 'warning' | 'error'; + +interface CustomAlertProps { + type: AlertType; + title: string; + message: string; + icon?: string; + actionLabel?: string; + onAction?: () => void; + onClose?: () => void; + className?: string; +} + +const CustomAlert: React.FC = ({ + type, + title, + message, + icon, + actionLabel, + onAction, + onClose, + className = '', +}) => { + // Default icons based on alert type + const defaultIcons = { + info: 'heroicons:information-circle', + success: 'heroicons:check-circle', + warning: 'heroicons:exclamation-triangle', + error: 'heroicons:document-text', + }; + + // Colors based on alert type + const colors = { + info: { + bg: 'bg-info/10', + border: 'border-info', + iconBg: 'bg-info/20', + iconColor: 'text-info', + actionBg: 'bg-info', + actionHover: 'hover:bg-info-focus', + actionRing: 'focus:ring-info', + }, + success: { + bg: 'bg-success/10', + border: 'border-success', + iconBg: 'bg-success/20', + iconColor: 'text-success', + actionBg: 'bg-success', + actionHover: 'hover:bg-success-focus', + actionRing: 'focus:ring-success', + }, + warning: { + bg: 'bg-warning/10', + border: 'border-warning', + iconBg: 'bg-warning/20', + iconColor: 'text-warning', + actionBg: 'bg-warning', + actionHover: 'hover:bg-warning-focus', + actionRing: 'focus:ring-warning', + }, + error: { + bg: 'bg-error/10', + border: 'border-error', + iconBg: 'bg-error/20', + iconColor: 'text-error', + actionBg: 'bg-error', + actionHover: 'hover:bg-error-focus', + actionRing: 'focus:ring-error', + }, + }; + + const color = colors[type]; + const selectedIcon = icon || defaultIcons[type]; + + return ( +
+
+
+
+
+ +
+
+
+

+ {title} +

+

+ {message} +

+
+
+
+ {actionLabel && onAction && ( + + )} + {onClose && ( + + )} +
+
+
+ ); +}; + +export default CustomAlert; \ No newline at end of file