• Stars
    star
    111
  • Rank 313,053 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A react component to show growl-like notifications using bootstrap alerts

React Bootstrap Notifier

A react component to show growl-like notifications using bootstrap alerts.

See a live demo.

Usage

npm install react-bs-notifier --save

To show a list of different types of alerts in the top right corner of the page:

import React from "react";
import ReactDOM from "react-dom";
import { AlertList } from "react-bs-notifier";

const alerts = [{
	id: 1,
	type: "info",
	message: "Hello, world"
}, {
	id: 2,
	type: "success",
	message: "Oh, hai"
}]

ReactDOM.render((
	<AlertList alerts={alerts} />
), document.getElementById("myApp"));

Or to show a single inline-alert:

import React from "react";
import ReactDOM from "react-dom";
import { Alert } from "react-bs-notifier";

ReactDOM.render((
	<Alert type="danger" headline="Error!">
		Holy cow, man!
	</Alert>
), document.getElementById("myApp"));

Or show alerts without creating an array (equivalent to first example):

import React from "react";
import ReactDOM from "react-dom";
import { Alert, AlertContainer } from "react-bs-notifier";

ReactDOM.render((
	<AlertContainer>
		<Alert type="info">Hello, world</Alert>
		<Alert type="success">Oh, hai</Alert>
	</AlertContainer>
), document.getElementById("myApp"));

Read the documentation for more in-depth, interactive examples and live demos.

Contributing

PRs Welcome

If you have a new feature or change you'd like to submit, please submit an issue first to talk about the change you want to make. When you are finished making your change, please make sure to also update the documentation. Once you clone this repo, you can run the docs & example app locally:

npm install
npm start

This will spin up a webpack dev server on port 1341. Open your browser to localhost:1341 and any changes you make will build & refresh the page automatically.

Linting

To run the linter:

npm run lint

This project uses prettier for formatting and will fail linting if the code doesn't conform to prettier's output. To automatically fix any formatting issues, run:

npm run lint -- --fix

Or, if you are using an editor that supports ESLint, just make sure to enable automatically fixing lint errors on save. E.g., in Visual Studio Code with the ESLint plugin, make sure this is in your settings.json:

{
  "eslint.autoFixOnSave": true
}

More Repositories

1

Geocoding.net

C# GeoCoding / Address Validation API
C#
443
star
2

lottie-to-svg

Convert a lottie animation to an SVG file
JavaScript
93
star
3

requirejs-web-workers

Loader plugin to use web workers with require.js
JavaScript
47
star
4

ghost

Ghost on Azure App Service
JavaScript
28
star
5

chadly.net

Personal website built with Gatsby
MDX
16
star
6

xunit-bdd

Small BDD Framework built on top of xUnit
C#
13
star
7

gatsby-plugin-env-variables

Gatsby plugin to allow system environment variables to be made available to client-side scripts
JavaScript
11
star
8

gui.keepass.io

A web GUI for your Keepass database
JavaScript
10
star
9

flowise

A template to create an LLM app using Flowise
Shell
8
star
10

rtsp

RTSP Camera Streaming to Chromecast
C#
5
star
11

gatsby-remark-lottie

Gatsby remark plugin to embed lottie JSON animations with SVG placeholders
JavaScript
5
star
12

react-socket-hooks

A set of react hooks to work real nice with the WebSocket API
JavaScript
4
star
13

smartthings

My collection of SmartThings apps and device handlers
Groovy
4
star
14

eslint-plugin-inflection

ESLint plugin to check inflection of filenames
JavaScript
3
star
15

metalsmith-flatten

A metalsmith plugin to flatten a directory hierarchy
JavaScript
3
star
16

markdown-folder-transformer

Migrates my obsidian vault to Logseq format
TypeScript
2
star
17

cams

Post-process recorded surveillance camera footage from Foscam & Amcrest cameras
C#
2
star
18

signal-gpt

Connect GPT-4 to your Signal phone number
TypeScript
2
star
19

clean-blog

Ghost 2.0 Theme
HTML
1
star
20

gatsby-plugin-hello-dev

Gatsby plugin to add an HTML comment to the top of your pages greeting developers who view source of your site
JavaScript
1
star
21

obsidian-logseq-gpt-migrator

Migrate my Obsidian vault to Logseq using GPT-4
TypeScript
1
star
22

clone-github-org

A .net CLI utility to clone all repositories in a Github org
C#
1
star
23

prod-env-variables

Use one set of environment variables on development branches and another set on the default branch.
JavaScript
1
star
24

trogdor

After Effects web animation of Trogdor
1
star