Skip to content

Commit ad5eacc

Browse files
committed
Add notifications, base variant
1 parent dafcc47 commit ad5eacc

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

components/SLDSNotification/index.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
16+
class Notification extends React.Component {
17+
constructor(props){
18+
super(props);
19+
this.state = {};
20+
}
21+
22+
getClassName() {
23+
return classNames(this.props.className, 'slds-notify ', {
24+
[`slds-notify--${this.props.variant}`]: this.props.variant,
25+
[`slds-theme--${this.props.theme}`]: this.props.theme,
26+
[`slds-theme--alert-texture`]: this.props.texture,
27+
});
28+
}
29+
30+
render(){
31+
return(
32+
<div className="slds-notify-container">
33+
<div className={this.getClassName()} role="alert">
34+
<SLDSButton
35+
label='Close'
36+
variant='icon'
37+
iconName='close'
38+
inverse={true}
39+
className='slds-button slds-button--icon-inverse slds-notify__close'
40+
onClick={this.props.onDismiss}
41+
/>
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>
48+
</div>
49+
</div>
50+
);
51+
}
52+
}
53+
Notification.propTypes = {
54+
};
55+
module.exports = Notification;
56+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 {default as PrismCode} from "react-prism/lib/PrismCode";
15+
16+
module.exports = React.createClass( {
17+
18+
getDefaultProps () {
19+
return {};
20+
},
21+
22+
getInitialState () {
23+
return {};
24+
},
25+
26+
render() {
27+
let message = ['Your new contact, ', <a href="#">Sara Smith</a>, ', has been created.'];
28+
return (
29+
30+
<div className='slds-p-around--medium'>
31+
<h3 className='slds-text-heading--medium slds-truncate'>
32+
Notification
33+
</h3>
34+
<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} />
37+
</div>
38+
</div>
39+
</div>
40+
41+
42+
);
43+
}
44+
});
45+

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)