+ + From 70930cd7be21ce3d5f9c842ca06805cb294aa839 Mon Sep 17 00:00:00 2001 From: Donielle Berg Date: Tue, 3 Nov 2015 15:07:05 -0800 Subject: [PATCH 2/2] Add notifications:toast variant --- components/SLDSButton/index.js | 1 + components/SLDSNotification/index.js | 25 +++++--- ...esforce-lightning-design-system-scoped.css | 3 + demo/pages/HomePage/NotificationSection.jsx | 61 +++++++++++++++++-- 4 files changed, 76 insertions(+), 14 deletions(-) diff --git a/components/SLDSButton/index.js b/components/SLDSButton/index.js index 359572c9cc..004d7bd039 100644 --- a/components/SLDSButton/index.js +++ b/components/SLDSButton/index.js @@ -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, }); } diff --git a/components/SLDSNotification/index.js b/components/SLDSNotification/index.js index eded06917d..9ee9c8c213 100644 --- a/components/SLDSNotification/index.js +++ b/components/SLDSNotification/index.js @@ -12,8 +12,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import React from 'react'; const classNames = require('classnames'); import SLDSButton from '../SLDSButton'; +import {Icon} from '../SLDSIcons'; -class Notification extends React.Component { +class SLDSNotification extends React.Component { constructor(props){ super(props); this.state = {}; @@ -35,22 +36,26 @@ class Notification extends React.Component { label='Close' variant='icon' iconName='close' + iconSize='large' inverse={true} - className='slds-button slds-button--icon-inverse slds-notify__close' + className='slds-button slds-notify__close' onClick={this.props.onDismiss} /> - Info -
-

- {this.props.content} -

-
+ + {this.props.theme} + +
+ +

{this.props.content}

+
+
+ ); } } -Notification.propTypes = { +SLDSNotification.propTypes = { }; -module.exports = Notification; +module.exports = SLDSNotification; diff --git a/demo/assets/styles/salesforce-lightning-design-system-scoped.css b/demo/assets/styles/salesforce-lightning-design-system-scoped.css index abca201a4a..0daa7ca78b 100644 --- a/demo/assets/styles/salesforce-lightning-design-system-scoped.css +++ b/demo/assets/styles/salesforce-lightning-design-system-scoped.css @@ -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; diff --git a/demo/pages/HomePage/NotificationSection.jsx b/demo/pages/HomePage/NotificationSection.jsx index c5bd2c87f9..0e63773183 100644 --- a/demo/pages/HomePage/NotificationSection.jsx +++ b/demo/pages/HomePage/NotificationSection.jsx @@ -11,6 +11,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 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( { @@ -20,11 +21,60 @@ module.exports = React.createClass( { }, getInitialState () { - return {}; + return { + modalIsOpen: false + }; + }, + + getModalContent(){ + return ( +
+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+

wjefiowjefio wejoif wejiof jfiowejfo ijw

+
+ ) + }, + + openModal () { + this.setState({modalIsOpen: true}); + }, + + closeModal () { + this.setState({modalIsOpen: false}); + }, + + handleSubmitModal () { + this.closeModal(); }, render() { - let message = ['Your new contact, ', Sara Smith, ', has been created.']; + let message = ['New contact added ', Sara Smith]; + let errorMessage = 'Error'; return (
@@ -32,9 +82,12 @@ module.exports = React.createClass( { Notification
-
- + 1. Toasts +
+
+ + 2. Modal Toasts