1
0

Тайлбар байхгүй

Jonathan Graham cdab1127d4 Merge pull request #26 from jonathan-grah/dependabot/npm_and_yarn/babel/traverse-7.23.2 1 жил өмнө
dist 158670c530 fix: padding issues when 'close' icon isn't there 4 жил өмнө
example 158670c530 fix: padding issues when 'close' icon isn't there 4 жил өмнө
src 158670c530 fix: padding issues when 'close' icon isn't there 4 жил өмнө
.babelrc 37d9c300b9 refactored structure & webpack 5 жил өмнө
.gitignore 7a5230e223 feat: position top, bottom, left and right 5 жил өмнө
.npmignore 7a5230e223 feat: position top, bottom, left and right 5 жил өмнө
LICENCE.md b83424cf45 v2.1.2: security fixes and small bug fix 4 жил өмнө
README.md 573f4d5057 feat: multiple ways of creating a toast (e.g. a toast with no custom options) 4 жил өмнө
package-lock.json fcdbfc5886 chore(deps-dev): bump @babel/traverse from 7.13.15 to 7.23.2 1 жил өмнө
package.json 56aee6b0f7 chore(deps): bump debug and webpack-cli 2 жил өмнө
webpack.config.js 12a029fd1b refactor: default timeout of 6 seconds if timeout not specified 4 жил өмнө

README.md

toasters

Toast alerts/notifications (initially developed for Vue.js with a material-design style)

Installation

npm install --save --production toasters

Usage

HTML:

<div id="toasts-container" class="position-right position-bottom">
  <div id="toasts-content">
    <!-- toasts will be added or removed from here -->
  </div>
</div>

JS:

import Toast from "toasters";

// example
new Toast({
  content: "Hello World",
  interactable: false
});

// or
new Toast("Hello World");

// or
new Toast("Hello World", { persistent: true, timeout: 9000 });

Preview:

preview of visible toast on webpage

Options

Option Type Default Description
content String "" The notification message.
persistent Boolean false Whether or not the toast is persistent.
interactable Boolean true If the toast can be manually closed or not.
timeout Number 6000 How long till the toast disappears. Note: will be ignored if the toast is persistent.
visible Boolean true If the toast will be visible when instantiated.

Potential future additions

  • Error handling (i.e. you haven't provided any content for the toast)
  • Ability to parse markdown or html

Contributing

# install dependencies
npm install

# watch files for changes with webpack
npm run dev

# build for production with minification
npm run build