New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@dccs/react-notification-mui

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dccs/react-notification-mui

React-Autocomplete without the tears

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

react-notification-mui · travis build npm version

Simple Notifications https://dccs-it-business-solutions.github.io/react-notification-mui/

Installation

You should install react-notification-mui with npm or yarn:

npm install @dccs/react-notification-mui
or
yarn add @dccs/react-notification-mui

This command will download and install react-notification-mui

How it works

To use display notifications wrap you application with the NotificationContextProvider

<NotificationContextProvider>
  <YourApp />
</NotificationContextProvider>

How to display notifications

The NotificationContextProvider provides the following functions:

  • addInfo
  • addWarning
  • addError
  • addCustomNotification

  • addInfo, addWarning, addError

    Parameters:
  • message: string | React.ReactNode
  • title?: string | React.ReactNode
  • Usage:
    function DisplayNotifications() {
      const { addInfo, addWarning, addError } =
        React.useContext < INotificationContext > NotificationContext;
      function handleClick() {
        addInfo("my message");
        addWarning("my message");
        addError("my message");
    
        addInfo(<span>my message</span>);
        addWarning(<span>my message</span>);
        addError(<span>my message</span>);
    
        addInfo("my message", "my title");
        addWarning("my message", "my title");
        addError("my message", "my title");
    
        addInfo(<span>my message</span>, <span>my mytitle</span>);
        addWarning(<span>my message</span>, <span>my mytitle</span>);
        addError(<span>my message</span>, <span>my mytitle</span>);
      }
    
      return <div onClick={handleClick}>Show Notifications</div>;
    }
    

    addCustomNotification

    If you want to display a custom notification you can use the addCustomNotification method.

    Parameters:

    notification: ICustomNotificationProps

    ICustomNotificationProps
    NameTypeDefault
    message`stringReact.ReactNode`
    autoHideDuration`numberundefiend`
    enableClickAway`booleanundefiend`
    transitionDuration`numberundefiend`
    snackBarStyle`React.CSSPropertiesundefiend`
    snackBarMessageStyle`React.CSSProptiersundefiend`
    snackBarMessageVariantThemeStyle`undefiend`
    snackBarTitleStyle`React.CSSProptiersundefiend`
    snackBarTitleVariantThemeStyle`undefiend`
    title`stringReact.ReactNode
    action`React.ReactNodeundefiend`

    ThemeStyle

    Usage:
    function DisplayMyCustomNotification(){
     const { addCustomNotification } =
        React.useContext < INotificationContext > (NotificationContext);
    
      function handleClick(){
        addCustomNotification({message:"my message"});
      }
    
      return <Butonn onClick={handleClick}>Show Custom Notifications</Button>
    }
    

    How to customize notifications shown by addInfo, addWarning, addError

    You are able to customize the look of the info, warning and error notifications threw properties given to to the NotificationContextProvider

    Contributing

    License

    @dccs/react-notification-mui is MIT licensed

    Keywords

    npm

    FAQs

    Package last updated on 10 Sep 2019

    Did you know?

    Socket

    Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

    Install

    Related posts