npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-app-notifier

v0.1.4

Published

This is a customizable react toaster library that can be used to display success and error messages in react app.

Downloads

3

Readme

React-App-Notifier

This is a customizable react toaster library that can be used to display success and error messages in react app.

Installation:

The easiest way to use react-select is to install it from npm and build it into your app with Webpack.

npm install react-app-notifier

Or with yarn:

yarn add react-app-notifier

Usage:

    import { NotifierProvider } from "react-app-notifier";

    <NotifierProvider>
        <App />
    </NotifierProvider>

Add the above in your root file (index.tsx)

    import { useNotifier, Notifier } from "react-app-notifier";

    export const App = () => {
        const {notifier} = useNotifier()

        function handleNotif () {
            notifier.show("Message Text", "Message Title", "success")
        }

        return (
            <>
                <Notifier/>
                <button 
                    onClick={handleNotif}
                >
                    Show Notifier
                </button>
            </>
        )
    }

As seen above, the Notifier component is added in the parent component of the application. Whenever you want to trigger the notifier/toaster, you just need to call the notifier.show function and pass the necessary parameters.

The notifier.show function takes in 3 parameters which are;

  • Message content
  • Message title
  • Message type (success, error)

The title is defaulted to null if not passed and "Success Response" will be used as title for type success while "Error Response" will be used as title for type error. The type parameter is optional and error is used as type by default if not type is not passed.

Below is sample of how the Notifier look like for type success

Notifier For Type Success

Controllable Props:

You can control the following props by providing values for them. If you don't, react-app-notifier will manage them for you.

  • bgColor: This is the background color of the Notifier. The default is #ffffff
  • titleColor: This is the title text color. The default is #101828
  • contentColor: This is content text color. The default is #667085
  • closeBtnColor: This is the color of the close icon. The default is #000000
  • closeBtnBgColor: This is the background color of the close icon. The defaut is white
  • closeBtnHoverBgColor: This is the background color of the close icon when it is being hovered on
  • closeBtnHoverColor: This is the color of the close icon when it is hovered on
  • showDismissText: This is a boolean value which determines whether to show the dismiss text or not. It is set to true by default
  • dismissText: This is the dismiss text. Dismiss is used by default
  • dismissTextColor: This is the color of the dismiss text
  • dismissTextHoverColor: This is the color of the dismiss text when it is hovered on

Github Repo:

To learn more, check out the Library Source Code.