/
AtlasProgrammer
/
pp-heat-map
Обзор
Документация
Войти
/
AtlasProgrammer
/
pp-heat-map
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
frontend/src/components/NotificationProvider.tsx
34 строки
881 B
AtlasProgrammer
upload files frontend
07 ноя 2025, 13:02
07 ноя 2025, 13:02
e56909e
Код
Авторство
О чём код?
import React from 'react'; import { Snackbar, Alert, AlertColor } from '@mui/material'; import { useAppStore } from '../store'; const NotificationProvider: React.FC = () => { const { notification, hideNotification } = useAppStore(); const handleClose = (_: React.SyntheticEvent | Event, reason?: string) => { if (reason === 'clickaway') { return; } hideNotification(); }; return ( <Snackbar open={notification.open} autoHideDuration={4000} onClose={handleClose} anchorOrigin={{ vertical: 'top', horizontal: 'right' }} > <Alert onClose={handleClose} severity={notification.type as AlertColor} variant="filled" sx={{ width: '100%' }} > {notification.message} </Alert> </Snackbar> ); }; export default NotificationProvider;