| 1 |
import CloseButton from '@elementor/ui/CloseButton'; |
| 2 |
import Snackbar from '@elementor/ui/Snackbar'; |
| 3 |
import SnackbarContent from '@elementor/ui/SnackbarContent'; |
| 4 |
import { useSettings } from '../hooks/use-settings'; |
| 5 |
|
| 6 |
const ReviewNotifications = ( { type, message } ) => { |
| 7 |
const { |
| 8 |
showNotification, |
| 9 |
setShowNotification, |
| 10 |
setNotificationMessage, |
| 11 |
setNotificationType, |
| 12 |
} = useSettings(); |
| 13 |
|
| 14 |
const closeNotification = () => { |
| 15 |
setShowNotification( ! showNotification ); |
| 16 |
setNotificationMessage( '' ); |
| 17 |
setNotificationType( '' ); |
| 18 |
}; |
| 19 |
|
| 20 |
if ( ! showNotification ) { |
| 21 |
return null; |
| 22 |
} |
| 23 |
|
| 24 |
return ( |
| 25 |
<Snackbar |
| 26 |
open={ showNotification } |
| 27 |
autoHideDuration={ type === 'error' ? 10000 : 2000 } |
| 28 |
onClose={ closeNotification } |
| 29 |
anchorOrigin={ { vertical: 'bottom', horizontal: 'right' } } |
| 30 |
sx={ { zIndex: 99999 } } |
| 31 |
> |
| 32 |
<SnackbarContent |
| 33 |
message={ message } |
| 34 |
action={ <CloseButton color="inherit" onClick={ closeNotification } /> } /> |
| 35 |
</Snackbar> |
| 36 |
); |
| 37 |
}; |
| 38 |
|
| 39 |
export default ReviewNotifications; |
| 40 |
|