Skip to content

Notifications #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/SLDSButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Button extends React.Component {
['slds-max-small-button--stretch']: this.props.responsive,
['slds-not-selected']: notSelected,
['slds-is-selected']: isSelected,
['slds-button--icon-inverse']: this.props.inverse,
});
}

Expand Down
61 changes: 61 additions & 0 deletions components/SLDSNotification/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Copyright (c) 2015, salesforce.com, inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
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.
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.

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.
*/

import React from 'react';
const classNames = require('classnames');
import SLDSButton from '../SLDSButton';
import {Icon} from '../SLDSIcons';

class SLDSNotification extends React.Component {
constructor(props){
super(props);
this.state = {};
}

getClassName() {
return classNames(this.props.className, 'slds-notify ', {
[`slds-notify--${this.props.variant}`]: this.props.variant,
[`slds-theme--${this.props.theme}`]: this.props.theme,
[`slds-theme--alert-texture`]: this.props.texture,
});
}

render(){
return(
<div className="slds-notify-container">
<div className={this.getClassName()} role="alert">
<SLDSButton
label='Close'
variant='icon'
iconName='close'
iconSize='large'
inverse={true}
className='slds-button slds-notify__close'
onClick={this.props.onDismiss}
/>

<span className="slds-assistive-text">{this.props.theme}</span>

<section className="notify__content slds-grid">
<Icon category='utility' name={this.props.icon} size='small' className='slds-m-right--x-small slds-col slds-no-flex' />
<h2 className="slds-col slds-align-middle slds-text-heading--small"> {this.props.content} </h2>
</section>

</div>
</div>

);
}
}
SLDSNotification.propTypes = {
};
module.exports = SLDSNotification;

Original file line number Diff line number Diff line change
Expand Up @@ -2624,6 +2624,9 @@ body {
top: 0;
z-index: 10000;
text-align: center; }
.demo-only .slds-notify-container {
position: relative;
}
.slds .slds-notify {
color: white;
position: relative;
Expand Down
98 changes: 98 additions & 0 deletions demo/pages/HomePage/NotificationSection.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
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.
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.
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.
*/

'use strict';

import React from 'react';
import SLDSNotification from '../../../components/SLDSNotification';
import {SLDSButton, SLDSModal} from '../../../components';
import {default as PrismCode} from "react-prism/lib/PrismCode";

module.exports = React.createClass( {

getDefaultProps () {
return {};
},

getInitialState () {
return {
modalIsOpen: false
};
},

getModalContent(){
return (
<div>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
<p> wjefiowjefio wejoif wejiof jfiowejfo ijw </p>
</div>
)
},

openModal () {
this.setState({modalIsOpen: true});
},

closeModal () {
this.setState({modalIsOpen: false});
},

handleSubmitModal () {
this.closeModal();
},

render() {
let message = ['New contact added ', <a href="#" key="0123">Sara Smith</a>];
let errorMessage = 'Error';
return (

<div className='slds-p-around--medium'>
<h3 className='slds-text-heading--medium slds-truncate'>
Notification
</h3>
<div className='slds-p-vertical--large'>
1. Toasts
<div className="demo-only">
<SLDSNotification variant='toast' theme='success' icon='notification' texture={true} content={message} animated={true} />
</div>

2. Modal Toasts
</div>
</div>


);
}
});

4 changes: 4 additions & 0 deletions demo/pages/HomePage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {ButtonIcon, Icon} from "./../../../components/SLDSIcons";
import ButtonSection from './ButtonSection';
import ButtonGroupSection from './ButtonGroupSection';

import NotificationSection from './NotificationSection';

import LookupBaseSection from './LookupBaseSection';
import LookupBaseDynamicSection from './LookupBaseDynamicSection';

Expand Down Expand Up @@ -70,6 +72,8 @@ module.exports = React.createClass( {
<main className='stage-main slds-grid slds-wrap slds-grow' role='main'>
<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'>

<NotificationSection/>

<ButtonSection/>

<ButtonGroupSection />
Expand Down