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

doom-react-notifications

v0.1.12

Published

A simple react notification system

Downloads

4

Readme

notifications_preview

Why ⁉️

Why another react notification system ? Why not, this project appears from the need to have an easy and very customizable react library, and more important, to be a project who everyone can contribute to improve it.

Make your pull request with your ideas. 🧙‍♂️

Features 😎

  • Fast and simple to use.
  • Custom Notification component.
  • Easy customization.
  • Multiple notifications type.
  • Multiple animations. (WIP)

Documentation 🔗

Go to Documentation to look more features and functionalities.

visit the npm package npm package

Installation 🐚

First install the library you can use the package manager what you like.

$ npm i doom-react-notifications
$ pnpm i doom-react-notifications
$ yarn add doom-react-notifications

Usage 📖

First you need to know the notification object, have basic properties to manage the notification.

const notification = {
  type: "success", // type of the notification (success, danger, error, info...)
  title: "Title of the notification",
  message: "body message of the notification",
};

To start using the library you only need to envolve your notification space in the component <NotificationProvier />, then you can use the hook useNotification, the example below show you a simple case of use.

import {
  NotificationProvider,
  NotificationConsumer,
} from "doom-react-notifications";
import { Button } from "./components/Button";
import "doom-react-notifications/dist/style.css"; // you can change the styles.

export default function App() {
  return (
    <NotificationProvider>
      <Button />
      <NotificationConsumer />
    </NotificationProvider>
  );
}

And then trigger the notification with the hook provided for the library.

import {useNotification} from "doom-react-notifications";

export function Button () {
  const { showNotification } = useNotification();

  const handleClick = () => {
    showNotification({
      ...
    });
  }

  return (
    <button onClick={handleClick}>
      Show Notification
    </button>
  )
}

Custom Notification Component 💅

You can create your own notification component with your custom structure and styles, to use it pass the custom component as Custom prop to <NotificationProvider />, as show below.

// Create a component that is given all the necessary properties for the notification as a props.
const CustomNotification = ({ type, message, onClick }) => {
  return (
    <div onClick={onClick} style={{ borderStyle: "dashed" }}>
      <p className="notification-title">{title}</p>
      <p className="notification-message">{message} with custom skeleton</p>
    </div>
  );
};

// Then pass the component as Custom prop.
export default function App() {
  return (
    <NotificationProvider>
      <Button />
      <NotificationConsumer Custom={CustomNotification} />
    </NotificationProvider>
  );
}

Contributing ❤️

To make a contribution, open a pull request, i be glad to read and share ideas of how improve this project.