Project

General

Profile

« Previous | Next » 

Revision 68cd4bba

Added by matanw about 7 years ago

fixes #14178 - Introduce patternfly toast notifications

View differences:

webpack/stories/index.js
import React from 'react';
/* eslint-disable no-unused-vars, no-console */
/* eslint-disable no-unused-vars */
import { storiesOf, action, linkTo, addDecorator } from '@kadira/storybook';
require('../assets/javascripts/bundle');
require('../../app/assets/javascripts/application');
......
import PowerStatusInner from
'../assets/javascripts/react_app/components/hosts/powerStatus/powerStatusInner';
import Store from '../assets/javascripts/react_app/redux';
import Toast from '../assets/javascripts/react_app/components/notifications/toast/Toast';
import Toast from '../assets/javascripts/react_app/components/toastNotifications/toastListitem';
addDecorator((story) => (
<div className="ca" style={{ textAlign: 'center' }}>
......
)
);
function dismiss() {
console.log('callback executed');
function getDismiss() {
return action('dismiss alert');
}
storiesOf('Notifications', module)
.add('Error', () => (
<Toast message="Please don't do that again" type="error" dismiss={dismiss} />
<Toast message="Please don't do that again" type="error" dismiss={getDismiss()} />
))
.add('Oops - no close', () => (
<Toast message="Please don't do that again" type="error" dismissable={false} sticky={true} />
))
.add('Success with link', () => (
<Toast message="Payment received"
link="click for details" dismiss={dismiss} />
type="success"
link={ {title: 'click for details', href: 'google.com'} } dismiss={getDismiss()} />
))
.add('Warning', () => (
<Toast message="I'm not sure you should do that" type="warning" dismiss={dismiss} />
<Toast message="I'm not sure you should do that" type="warning" dismiss={getDismiss()} />
))
.add('Short life', () => (
<Toast message="I'm about to expire" type="warning" dismiss={dismiss} />
<Toast message="I'm about to expire" type="warning" dismiss={getDismiss()} />
))
.add('Sticky', () => (
<Toast message="I'm Going to stick around" type="warning" sticky={true} dismiss={dismiss} />
<Toast message="I'm Going to stick around"
type="warning"
sticky={true}
dismiss={getDismiss()} />
)
);

Also available in: Unified diff