Skip to content

Commit 16c2fa7

Browse files
committed
Merge pull request #50 from salesforce-ux/notifications
Notifications
2 parents ebc8c32 + 37670fc commit 16c2fa7

File tree

5 files changed

+167
-0
lines changed

5 files changed

+167
-0
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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7+
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10+
*/
11+
12+
import React from 'react';
13+
const classNames = require('classnames');
14+
import SLDSButton from '../SLDSButton';
15+
import {Icon} from '../SLDSIcons';
16+
17+
class SLDSNotification extends React.Component {
18+
constructor(props){
19+
super(props);
20+
this.state = {};
21+
}
22+
23+
getClassName() {
24+
return classNames(this.props.className, 'slds-notify ', {
25+
[`slds-notify--${this.props.variant}`]: this.props.variant,
26+
[`slds-theme--${this.props.theme}`]: this.props.theme,
27+
[`slds-theme--alert-texture`]: this.props.texture,
28+
});
29+
}
30+
31+
render(){
32+
return(
33+
<div className="slds-notify-container">
34+
<div className={this.getClassName()} role="alert">
35+
<SLDSButton
36+
label='Close'
37+
variant='icon'
38+
iconName='close'
39+
iconSize='large'
40+
inverse={true}
41+
className='slds-button slds-notify__close'
42+
onClick={this.props.onDismiss}
43+
/>
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+
52+
</div>
53+
</div>
54+
55+
);
56+
}
57+
}
58+
SLDSNotification.propTypes = {
59+
};
60+
module.exports = SLDSNotification;
61+

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;
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
6+
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
7+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8+
*/
9+
10+
'use strict';
11+
12+
import React from 'react';
13+
import SLDSNotification from '../../../components/SLDSNotification';
14+
import {SLDSButton, SLDSModal} from '../../../components';
15+
import {default as PrismCode} from "react-prism/lib/PrismCode";
16+
17+
module.exports = React.createClass( {
18+
19+
getDefaultProps () {
20+
return {};
21+
},
22+
23+
getInitialState () {
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();
73+
},
74+
75+
render() {
76+
let message = ['New contact added ', <a href="#" key="0123">Sara Smith</a>];
77+
let errorMessage = 'Error';
78+
return (
79+
80+
<div className='slds-p-around--medium'>
81+
<h3 className='slds-text-heading--medium slds-truncate'>
82+
Notification
83+
</h3>
84+
<div className='slds-p-vertical--large'>
85+
1. Toasts
86+
<div className="demo-only">
87+
<SLDSNotification variant='toast' theme='success' icon='notification' texture={true} content={message} animated={true} />
88+
</div>
89+
90+
2. Modal Toasts
91+
</div>
92+
</div>
93+
94+
95+
);
96+
}
97+
});
98+

demo/pages/HomePage/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {ButtonIcon, Icon} from "./../../../components/SLDSIcons";
1919
import ButtonSection from './ButtonSection';
2020
import ButtonGroupSection from './ButtonGroupSection';
2121

22+
import NotificationSection from './NotificationSection';
23+
2224
import LookupBaseSection from './LookupBaseSection';
2325
import LookupBaseDynamicSection from './LookupBaseDynamicSection';
2426

@@ -70,6 +72,8 @@ module.exports = React.createClass( {
7072
<main className='stage-main slds-grid slds-wrap slds-grow' role='main'>
7173
<div className='region region--main slds-grow slds-size--1-of-1 slds-medium-size--1-of-2 slds-large-size--8-of-12 slds-col-rule--right slds-p-around--large'>
7274

75+
<NotificationSection/>
76+
7377
<ButtonSection/>
7478

7579
<ButtonGroupSection />

0 commit comments

Comments
 (0)