0.1.17 • Published 5 years ago

toasts-manager v0.1.17

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

Toasts Manager

React toasts manager library.

Usage:

Import:

import ToastsManager, { Toast } from 'toasts-manager';

ReactDOM.render(
  <div>
    ...
    <ToastsManager renderToast={({ type, text, onClose }) => (
      <Toast onClick={onClose}>
        {type}: {text}
      </Toast>
    )} />
  </div>,
  document.getElementById('root')
)

ToastsManager props:

Show standard info/warn/error toasts:

// Show toast rendered by renderToast function with params type = 'info' and text
ToastsManager.info('Post sent success');

// Show toast rendered by renderToast function with params type = 'warn' and text
ToastsManager.warn('Comments depth exceeded');

// Show toast rendered by renderToast function with params type = 'error' and text
ToastsManager.error('Network Error');

Use with custom component:

import ToastsManager, { Toast } from 'toasts-manager';

ToastsManager.show(({ onClose }) => (
  <Toast>
    CUSTOM INNER HTML
    <button type="button" onClick={onClose}>
      DISMISS
    </button>
  </Toast>
));
0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

6 years ago

0.1.11

6 years ago