ne minor, a ebat fix
This commit is contained in:
38
README.md
38
README.md
@ -157,3 +157,41 @@ MIT © [Electron React Boilerplate](https://github.com/electron-react-boilerplat
|
||||
[github-tag-url]: https://github.com/electron-react-boilerplate/electron-react-boilerplate/releases/latest
|
||||
[stackoverflow-img]: https://img.shields.io/badge/stackoverflow-electron_react_boilerplate-blue.svg
|
||||
[stackoverflow-url]: https://stackoverflow.com/questions/tagged/electron-react-boilerplate
|
||||
|
||||
|
||||
|
||||
Для использования CustomNotification:
|
||||
|
||||
# IMPORTS
|
||||
import CustomNotification from '../components/Notifications/CustomNotification';
|
||||
import type { NotificationPosition } from '../components/Notifications/CustomNotification';
|
||||
import { getNotificationPosition } from '../utils/settings';
|
||||
|
||||
# STATE
|
||||
const [notifOpen, setNotifOpen] = useState(false);
|
||||
const [notifMsg, setNotifMsg] = useState<React.ReactNode>('');
|
||||
const [notifSeverity, setNotifSeverity] = useState<
|
||||
'success' | 'info' | 'warning' | 'error'
|
||||
>('info');
|
||||
|
||||
const [notifPos, setNotifPos] = useState<NotificationPosition>({
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center',
|
||||
});
|
||||
|
||||
# ВМЕСТО setNotification
|
||||
setNotifMsg('Ошибка при загрузке прокачки!'); // string
|
||||
setNotifSeverity('error'); // 'success' || 'info' || 'warning' || 'error'
|
||||
setNotifPos(getNotificationPosition()); // top || bottom & center || right || left
|
||||
setNotifOpen(true); // Не изменять
|
||||
|
||||
# СРАЗУ ПОСЛЕ ПЕРВОГО <Box>
|
||||
|
||||
<CustomNotification
|
||||
open={notifOpen}
|
||||
message={notifMsg}
|
||||
severity={notifSeverity}
|
||||
position={notifPos}
|
||||
onClose={() => setNotifOpen(false)}
|
||||
autoHideDuration={2500}
|
||||
/>
|
||||
Reference in New Issue
Block a user