Skip to content

Commit b281a97

Browse files
committed
Add state change in demo notification
1 parent 8db5df8 commit b281a97

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

components/SLDSNotification/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class SLDSNotification extends React.Component {
6262
if(nextProps.isOpen && !this.state.interval){
6363
this.setState({interval: setTimeout(() => {
6464
this.setState({revealForScreenreader: !this.state.revealForScreenreader});
65+
console.log('the isOpen state inside is', this.state.isOpen);
6566
}, 500)})
6667
}
6768
}

demo/pages/HomePage/NotificationSection.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ module.exports = React.createClass( {
7474
},
7575

7676
dismissToast(){
77+
this.setState({ alertIsOpen: false });
7778
console.log('====> Dismiss Toast Message');
7879
},
7980

80-
toggleAlert(){
81-
this.setState({ alertIsOpen: !this.state.alertIsOpen });
81+
openAlert(){
82+
this.setState({ alertIsOpen: true });
8283
},
8384

8485
render() {
@@ -108,7 +109,7 @@ module.exports = React.createClass( {
108109
<div className='slds-p-vertical--medium'>
109110
<div className="slds-p-vertical--small">
110111
<h4 className="slds-text-heading--small ">Alerts</h4>
111-
<SLDSButton variant="neutral" label="Show Alert" onClick={this.toggleAlert} />
112+
<SLDSButton variant="neutral" label="Show Alert" onClick={this.openAlert} />
112113
<SLDSNotification variant='alert' theme='success' icon='notification' isOpen={this.state.alertIsOpen} texture={true} content={successMsg} onDismiss={this.dismissToast} />
113114
</div>
114115

0 commit comments

Comments
 (0)