Skip to content

Commit 70930cd

Browse files
committed
Add notifications:toast variant
1 parent ad5eacc commit 70930cd

File tree

4 files changed

+76
-14
lines changed

4 files changed

+76
-14
lines changed

components/SLDSButton/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class Button extends React.Component {
4747
['slds-max-small-button--stretch']: this.props.responsive,
4848
['slds-not-selected']: notSelected,
4949
['slds-is-selected']: isSelected,
50+
['slds-button--icon-inverse']: this.props.inverse,
5051
});
5152
}
5253

components/SLDSNotification/index.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1212
import React from 'react';
1313
const classNames = require('classnames');
1414
import SLDSButton from '../SLDSButton';
15+
import {Icon} from '../SLDSIcons';
1516

16-
class Notification extends React.Component {
17+
class SLDSNotification extends React.Component {
1718
constructor(props){
1819
super(props);
1920
this.state = {};
@@ -35,22 +36,26 @@ class Notification extends React.Component {
3536
label='Close'
3637
variant='icon'
3738
iconName='close'
39+
iconSize='large'
3840
inverse={true}
39-
className='slds-button slds-button--icon-inverse slds-notify__close'
41+
className='slds-button slds-notify__close'
4042
onClick={this.props.onDismiss}
4143
/>
42-
<span className="slds-assistive-text">Info</span>
43-
<div className="notify__content">
44-
<h2 className="slds-text-heading--small">
45-
{this.props.content}
46-
</h2>
47-
</div>
44+
45+
<span className="slds-assistive-text">{this.props.theme}</span>
46+
47+
<section className="notify__content slds-grid">
48+
<Icon category='utility' name={this.props.icon} size='small' className='slds-m-right--x-small slds-col slds-no-flex' />
49+
<h2 className="slds-col slds-align-middle slds-text-heading--small"> {this.props.content} </h2>
50+
</section>
51+
4852
</div>
4953
</div>
54+
5055
);
5156
}
5257
}
53-
Notification.propTypes = {
58+
SLDSNotification.propTypes = {
5459
};
55-
module.exports = Notification;
60+
module.exports = SLDSNotification;
5661

demo/assets/styles/salesforce-lightning-design-system-scoped.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,6 +2624,9 @@ body {
26242624
top: 0;
26252625
z-index: 10000;
26262626
text-align: center; }
2627+
.demo-only .slds-notify-container {
2628+
position: relative;
2629+
}
26272630
.slds .slds-notify {
26282631
color: white;
26292632
position: relative;

demo/pages/HomePage/NotificationSection.jsx

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1111

1212
import React from 'react';
1313
import SLDSNotification from '../../../components/SLDSNotification';
14+
import {SLDSButton, SLDSModal} from '../../../components';
1415
import {default as PrismCode} from "react-prism/lib/PrismCode";
1516

1617
module.exports = React.createClass( {
@@ -20,21 +21,73 @@ module.exports = React.createClass( {
2021
},
2122

2223
getInitialState () {
23-
return {};
24+
return {
25+
modalIsOpen: false
26+
};
27+
},
28+
29+
getModalContent(){
30+
return (
31+
<div>
32+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
33+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
34+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
35+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
36+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
37+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
38+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
39+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
40+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
41+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
42+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
43+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
44+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
45+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
46+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
47+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
48+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
49+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
50+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
51+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
52+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
53+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
54+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
55+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
56+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
57+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
58+
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
59+
</div>
60+
)
61+
},
62+
63+
openModal () {
64+
this.setState({modalIsOpen: true});
65+
},
66+
67+
closeModal () {
68+
this.setState({modalIsOpen: false});
69+
},
70+
71+
handleSubmitModal () {
72+
this.closeModal();
2473
},
2574

2675
render() {
27-
let message = ['Your new contact, ', <a href="#">Sara Smith</a>, ', has been created.'];
76+
let message = ['New contact added ', <a href="#" key="0123">Sara Smith</a>];
77+
let errorMessage = 'Error';
2878
return (
2979

3080
<div className='slds-p-around--medium'>
3181
<h3 className='slds-text-heading--medium slds-truncate'>
3282
Notification
3383
</h3>
3484
<div className='slds-p-vertical--large'>
35-
<div className='slds-input-has-icon slds-input-has-icon--left'>
36-
<SLDSNotification variant='alert' theme='success' icon='notification' texture={true} content={message} animated={true} />
85+
1. Toasts
86+
<div className="demo-only">
87+
<SLDSNotification variant='toast' theme='success' icon='notification' texture={true} content={message} animated={true} />
3788
</div>
89+
90+
2. Modal Toasts
3891
</div>
3992
</div>
4093

0 commit comments

Comments
 (0)