import React, { useMemo } from 'react';
import * as ToastPrimitive from '@radix-ui/react-toast';
import { ToastProps } from '@radix-ui/react-toast';
import { motion } from 'framer-motion';
import { simpleToastTheme, type SimpleToastTheme } from './SimpleToast.theme';
import {
LoadingIcon,
CheckRoundFilledIcon,
CrossIcon,
InfoRoundFilledIcon,
WarningIcon,
} from 'components/shared/CustomIcon';
import { Button, type ButtonOrLinkProps } from 'components/shared/Button';
import { cloneIcon } from 'utils/cloneIcon';
type CtaProps = ButtonOrLinkProps & {
buttonLabel: string;
};
export interface SimpleToastProps extends ToastProps {
id: string;
title: string;
variant?: SimpleToastTheme['variant'];
cta?: CtaProps[];
onDismiss: (toastId: string) => void;
}
export const SimpleToast = ({
id,
className,
title,
variant = 'success',
cta = [],
onDismiss,
...props
}: SimpleToastProps) => {
const hasCta = cta.length > 0;
const {
wrapper: wrapperCls,
icon: iconCls,
closeIcon: closeIconCls,
title: titleCls,
} = simpleToastTheme({ variant });
const Icon = useMemo(() => {
if (variant === 'success') return
{title}