Skip to content

Commit caf1018

Browse files
committed
Merge pull request #56 from salesforce-ux/notifications
Add animations to notifications: alert
2 parents 42cbd6d + 2f40647 commit caf1018

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

components/SLDSNotification/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import {Icon} from '../SLDSIcons';
1717
class SLDSNotification extends React.Component {
1818
constructor(props){
1919
super(props);
20-
this.state = {isOpen: true};
20+
this.state = { isOpen: true };
2121
}
2222

2323
getClassName() {
2424
return classNames(this.props.className, 'slds-notify ', {
2525
[`slds-notify--${this.props.variant}`]: this.props.variant,
2626
[`slds-theme--${this.props.theme}`]: this.props.theme,
27-
[`slds-theme--alert-texture`]: this.props.texture,
27+
[`slds-theme--alert-texture-animated`]: this.props.texture,
2828
});
2929
}
3030

demo/assets/styles/animations.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.slds .slds-theme--alert-texture-animated {
2+
background-image: -webkit-linear-gradient(45deg, rgba(0, 0, 0, 0.035) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.035) 50%, rgba(0, 0, 0, 0.035) 75%, transparent 75%, transparent);
3+
background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.035) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.035) 50%, rgba(0, 0, 0, 0.035) 75%, transparent 75%, transparent);
4+
background-size: 64px 64px;
5+
animation: progress-bar-stripes 2.4s 4 linear;
6+
}
7+
8+
@keyframes progress-bar-stripes{
9+
0% { background-position:0 64px; }
10+
100% { background-position:0 0; }
11+
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4719,10 +4719,13 @@ body {
47194719
color: rgba(255, 255, 255, 0.5); }
47204720
.slds .slds-theme--offline a:not(.slds-button--neutral)[disabled] {
47214721
color: rgba(255, 255, 255, 0.15); }
4722+
47224723
.slds .slds-theme--alert-texture {
47234724
background-image: -webkit-linear-gradient(45deg, rgba(0, 0, 0, 0.035) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.035) 50%, rgba(0, 0, 0, 0.035) 75%, transparent 75%, transparent);
47244725
background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.035) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.035) 50%, rgba(0, 0, 0, 0.035) 75%, transparent 75%, transparent);
4725-
background-size: 64px 64px; }
4726+
background-size: 64px 64px;
4727+
}
4728+
47264729
.slds .slds-theme--inverse-text {
47274730
color: white; }
47284731
.slds .slds-theme--inverse-text a:not(.slds-button--neutral) {

demo/pages/HomePage/NotificationSection.jsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ module.exports = React.createClass( {
7777
},
7878

7979
render() {
80-
let message = ['New contact added ', <a href="#" key="0123">Sara Smith</a>];
81-
let errorMessage = 'There was a problem updating the record.';
80+
let successMsg = ['New contact added ', <a href="#" key="0123">Sara Smith</a>];
81+
let errorMsg = 'There was a problem updating the record.';
8282
let toastStyle = { display: 'inline-block'};
8383
return (
8484

@@ -94,23 +94,32 @@ module.exports = React.createClass( {
9494
</PrismCode>
9595
<div className='slds-p-vertical--medium'>
9696
<div className="slds-p-vertical--small">
97-
1. Toasts
98-
<br />
99-
<div className="demo-only" style={toastStyle}>
100-
{this.state.modalIsOpen ? null: <SLDSNotification variant='toast' theme='success' icon='notification' texture={true} content={message} onDismiss={this.dismissToast} animated={true} />}
97+
<h4 className="slds-text-heading--small ">Alerts</h4>
98+
<div className="demo-only">
99+
Base
100+
{this.state.modalIsOpen ? null: <SLDSNotification variant='alert' theme='success' icon='notification' texture={true} content={successMsg} onDismiss={this.dismissToast} />}
101+
102+
Animated
103+
{this.state.modalIsOpen ? null: <SLDSNotification variant='alert' theme='error' icon='warning' texture={true} content={errorMsg} onDismiss={this.dismissToast} />}
101104
</div>
102105
</div>
103106

104107
<div className="slds-p-vertical--small">
105-
2. Modal Toasts
106-
<br />
108+
<h4 className="slds-text-heading--small ">Toasts</h4>
109+
110+
<div className="demo-only" style={toastStyle}>
111+
Base
112+
{this.state.modalIsOpen ? null: <SLDSNotification variant='toast' theme='success' icon='notification' content={successMsg} onDismiss={this.dismissToast} />}
113+
</div>
114+
115+
<p>Modal Toasts</p>
107116
<SLDSButton
108117
label='Open Modal Toast'
109118
variant='brand'
110119
onClick={this.openModal} />
111120
<SLDSModal
112121
isOpen={this.state.modalIsOpen}
113-
toast={<SLDSNotification variant='toast' theme='error' icon='warning' texture={true} content={errorMessage} onDismiss={this.dismissToast} />}
122+
toast={<SLDSNotification variant='toast' theme='error' icon='warning' content={errorMsg} onDismiss={this.dismissToast} />}
114123
title={<span>Lightning Design System: Style with Ease</span>}
115124
footer={[
116125
<SLDSButton key='cancelBtn' label='Cancel' variant='neutral' onClick={this.closeModal} />,

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<link rel="stylesheet" type="text/css" href="demo/static/bundle.css">
1111

1212
<link rel="stylesheet" type="text/css" href="demo/assets/styles/salesforce-lightning-design-system-scoped.css">
13+
<link rel="stylesheet" type="text/css" href="demo/assets/styles/animations.css">
1314

1415
</head>
1516

0 commit comments

Comments
 (0)