import * as RadixToast from '@radix-ui/react-toast'; import { NotificationSeverity } from '~/common'; import { useToast } from '~/hooks'; export function Toast() { const { toast, onOpenChange } = useToast(); const severityClassName = { /* Going up by 100 units in terms of darkness (eg bg-green-500 to bg-green-600) for * bg colors produces colors that are too visually dissimilar to LibreChat's standard color palette. * These colors were derived by adjusting the values in the HSV color space using CCA * until the 4.5:1 contrast ratio threshold was met against white text while maintaining * a relatively recognizable color scheme for toasts without compromising accessibility. * */ [NotificationSeverity.INFO]: 'border-gray-500 bg-gray-500', [NotificationSeverity.SUCCESS]: 'border-[#02855E] bg-[#02855E]', [NotificationSeverity.WARNING]: 'border-[#C75209] bg-[#C75209]', [NotificationSeverity.ERROR]: 'border-[#E02F1F] bg-[#E02F1F]', }; return (
{toast.showIcon && (
)}
{toast.message}
); }