1.0.20 • Published 11 months ago

grand-notification v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Grand-Notification

Introduction

this is a notification plugin for web application realeased on npm. it is written in typescript and it supports javascript and typescript.

Demo

demo

Usage

  • Installation
npm i grand-notification

or

yarn add grand-notification
  • Import NotificationProvier

import NotificationProvider in your app.js or index.js or _app.js or _app.tsx or other root files

import { NotificationProvider } from "grand-notification"

...

function MyApp({ Component, pageProps }) {
    return (
        <>
            <NotificationProvider>
                <Component {...pageProps} />
            </NotificationProvider>
        </>
    )
}
  • useNotification & addNotification

import and use grand notification in any of your jsx or tsx files:

import { useNotification } from "grand-notification";

export default function component() {
  const { addNotification } = useNotification();

  addNotification("hello world!", "success", 4000);

  addNotification("hello world!", "error", 4000);

  addNotification("hello world!", "info", 4000);
}

Config

addNotification takes 3 params, messaage is what the text will be displayed on the notification, types are error, success, info which have different icons, displayTime is in ms, putting 3000 means this notification will display for 3 seconds.

const addNotification: (message: string, type: "error" | "success" | "info", displayTime: number) => void

1.0.20

11 months ago

1.0.18

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago