Last active
July 12, 2018 15:20
-
-
Save b2whats/b58aeb311b3a4400337ff672762828dc to your computer and use it in GitHub Desktop.
Notice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Так мы пушим нотификации из любого места системы, статическое свойство класса. | |
NotificationManager.addMessage({ | |
id?: number | string, | |
content: React.Node, | |
timeout?: number, | |
onClose?: (event: SyntheticEvent<HTMLElement>) => void | |
}) | |
<NotificationManager> | |
<NotificationBox placement='right-start' animation='slide-right' component={FloatingAlert} /> | |
<NotificationBox placement='right-end' animation='slide-right' component={Alert} /> | |
</NotificationManager> | |
======================= | |
const config = { | |
'right-start': { | |
animation: 'slide-right', | |
component: FloatingAlert | |
}, | |
'bottom': { | |
animation: 'slide-bottom', | |
component: Alert | |
} | |
} | |
<NotificationManager config={}/> | |
======================= | |
<NotificationManager> | |
{(notifications) => {[ | |
<NotificationBox key='1' placement='right-start' animation='slide-right' component={FloatingAlert} notifications={notifications['right-start']}/> | |
<NotificationBox key='2' placement='right-end' animation='slide-right' component={Alert} notifications={notifications['right-end']}/> | |
]}} | |
</NotificationManager> | |
======================= | |
NotificationBox.addMessage | |
<NotificationBox placement='right-start' animation='slide-right' component={FloatingAlert} /> | |
<NotificationBox placement='right-end' animation='slide-end' component={Alert} /> | |
======================= | |
NotificationBox.addMessage({ | |
id?: number | string, | |
content: React.Node, | |
timeout?: number, | |
onClose?: (event: SyntheticEvent<HTMLElement>) => void, | |
...otherProps | |
}) | |
<NotificationBox placement='right-start' animation='slide-right'> | |
{(notice) => { | |
<FloatingAlert onClose={notice.onClose} type={notice.otherProps.type}> | |
{notice.content} | |
</FloatingAlert> | |
}} | |
</NotificationBox> | |
Icon.setIcon(name, require) | |
<Icon name='myName' /> | |
=== | |
Icon.star = require() | |
<Icon src={Icon.star} /> | |
==== | |
<Icon src={Pack.star} /> | |
==== | |
const MyIcon = (...) => <Icon src={require()} /> | |
==== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Icon.setIcon(name, require)
===
Icon.star = require()
====
====
const MyIcon = (...) =>
====