Giter Club home page Giter Club logo

notifications's Introduction

No name yet ๐Ÿ˜ฅ

Notifications

Notifications is a customizable, appealing, and stylistic notification system.
Using Fontawesome, you can use tons of clean icons.

Usage

To use Notifications, first import the stylesheets in the head, like this:

<link rel="stylesheet" href="https://Battledash-2.github.io/Notifications/src/styles.css" />
<!-- or href="https://cdn.jsdelivr.net/gh/Battledash-2/Notifications@latest/src/styles.css" /> -->

To send notifications, import the file using the ES6 import syntax. Remember that you can only import scripts within modules, so on your script tag you have to use type="module"!

<script type="module">
	import * as Notifications from 'https://Battledash-2.github.io/Notifications/src/script.js'; // or 'https://cdn.jsdelivr.net/gh/Battledash-2/Notifications@latest/src/script.js';

	Notifications.ShowNotification(null, 'warning', Infinity, 'Hello!', 'INFO');
</script>

API

Notifications will be referred to as API.

API.remove(elm: HTMLElement): void;

  • Removes notification elm from the screen, while still showing the transition out.

API.ShowNotification(icon = 'fa-regular fa-bell', color = 'info', duration = 5000, text = 'Unknown', caption = 'Unknown', closable = true): HTMLElement;

  • Creates a new notifications and adds it to the screen.
    Returns the created element.

API.NotifExists(icon: string, color: string, text: string, caption: string): HTMLElement | null;

  • Checks if a notifications with the provided properties exists.
    Returns null or the element found.

Configuration

function Max(max?: number): number;

  • Sets the max amount of notifications on the screen at once if provided.
    Returns the new max.

function CounterMax(max?: number): number;

  • Sets the max amount for the small counter if provided.
    Returns the new counter max.

    function Types(typs?: Object): Object;

  • Sets the default types object if provided. The types object is a set of key/values, and each key is a type of notification. For example:

	info: {
		icon: 'fa-solid fa-circle-info',
		color: '#333333',
		caption: 'INFO',
	},
  • . With that, if you pass 'info' into the color parameter of the API.ShowNotification, it will set the color to the color from the object. If the icon parameter is null, it will also use the icon from the object. Same goes for the caption. When color is null or undefined, it will default to primary.
    Returns the new colors object.
  • Default types are: 'info', 'primary', 'success', 'error', 'warning' (all types must be lowercase)

You can find an example in ./test/index.html! ๐Ÿงช

Pictures:

example picture
example picture

notifications's People

Contributors

battledash-2 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.