24 lines
598 B
TypeScript
24 lines
598 B
TypeScript
import { Alert, Snackbar, type AlertColor } from '@mui/material';
|
|
import React, { type PropsWithChildren } from 'react';
|
|
|
|
export interface ToastProps extends PropsWithChildren {
|
|
color: AlertColor | undefined;
|
|
open: boolean;
|
|
onClose: () => void;
|
|
}
|
|
|
|
export const Toast = ({ color, open, onClose, children }: ToastProps) => {
|
|
return (
|
|
<Snackbar sx={{ minWidth: '396px' }} open={open} onClose={onClose}>
|
|
<Alert
|
|
onClose={onClose}
|
|
severity={color}
|
|
variant="filled"
|
|
sx={{ width: '100%' }}
|
|
>
|
|
{children}
|
|
</Alert>
|
|
</Snackbar>
|
|
);
|
|
};
|