@@ -23,7 +23,7 @@ module.exports = React.createClass( {
2323 getInitialState ( ) {
2424 return {
2525 modalIsOpen : false ,
26- toastsAreOpen : true ,
26+ alertIsOpen : false ,
2727 } ;
2828 } ,
2929
@@ -77,6 +77,10 @@ module.exports = React.createClass( {
7777 console . log ( '====> Dismiss Toast Message' ) ;
7878 } ,
7979
80+ toggleAlert ( ) {
81+ this . setState ( { alertIsOpen : ! this . state . alertIsOpen } ) ;
82+ } ,
83+
8084 render ( ) {
8185 let successMsg = [ 'New contact added ' , < a href = "#" key = "0123" > Sara Smith</ a > ] ;
8286 let errorMsg = 'There was a problem updating the record.' ;
@@ -104,27 +108,16 @@ module.exports = React.createClass( {
104108 < div className = 'slds-p-vertical--medium' >
105109 < div className = "slds-p-vertical--small" >
106110 < h4 className = "slds-text-heading--small " > Alerts</ h4 >
107- < div className = "demo-only" >
108- < div className = "slds-p-bottom--small" >
109- { this . state . modalIsOpen ? null : < SLDSNotification variant = 'alert' theme = 'success' icon = 'notification' texture = { true } content = { successMsg } onDismiss = { this . dismissToast } /> }
110- </ div >
111- < div className = "slds-p-bottom--small" >
112- { this . state . modalIsOpen ? null : < SLDSNotification variant = 'alert' theme = 'success' icon = 'notification' texture = { true } content = { successMsg } duration = { 5000 } onDismiss = { this . dismissToast } /> }
113- </ div >
114- < div className = "slds-p-bottom--small" >
115- { this . state . modalIsOpen ? null : < SLDSNotification variant = 'alert' theme = 'error' icon = 'warning' texture = { true } content = { errorMsg } onDismiss = { this . dismissToast } /> }
116- </ div >
117- < div className = "slds-p-bottom--small" >
118- { this . state . modalIsOpen ? null : < SLDSNotification variant = 'alert' icon = 'user' content = { offlineMsg } dismissible = { false } onDismiss = { this . dismissToast } /> }
119- </ div >
120- </ div >
111+ < SLDSButton variant = "neutral" label = "Show Alert" onClick = { this . toggleAlert } />
112+ < SLDSNotification variant = 'alert' theme = 'success' icon = 'notification' isOpen = { this . state . alertIsOpen } texture = { true } content = { successMsg } onDismiss = { this . dismissToast } />
121113 </ div >
122114
123115 < div className = "slds-p-vertical--small" >
124116 < h4 className = "slds-text-heading--small " > Toasts</ h4 >
125117 < div className = "demo-only" style = { toastStyle } >
126118 Base
127- { this . state . modalIsOpen ? null : < SLDSNotification variant = 'toast' theme = 'success' icon = 'notification' content = { successMsg } onDismiss = { this . dismissToast } /> }
119+ { this . state . modalIsOpen ? null :
120+ < SLDSNotification variant = 'toast' theme = 'success' icon = 'notification' content = { successMsg } onDismiss = { this . dismissToast } /> }
128121 </ div >
129122
130123 < p > Modal Toasts</ p >
0 commit comments