Skip to content

Commit

Permalink
Add extraClasses option (#202)
Browse files Browse the repository at this point in the history
* Add extraClasses option

* Bump minor version number

* Fix typo in variable
  • Loading branch information
yatharth committed Aug 25, 2021
1 parent a3a0a75 commit 188058a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface Options {
opacity?: number;
animate?: ToastAnimation;
appendTo?: Node;
extraClasses?: string;
}

export type ToastType = 'is-primary'
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bulma-toast",
"version": "2.3.1",
"version": "2.4.1",
"description": "Bulma's pure JavaScript extension to display toasts",
"main": "dist/bulma-toast.cjs.js",
"module": "dist/bulma-toast.esm.js",
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const baseConfig = {
offsetBottom: 0,
offsetLeft: 0,
offsetRight: 0,
extraClasses: '',
}
let defaults = { ...baseConfig }
let containers = {}
Expand Down Expand Up @@ -128,9 +129,10 @@ class Toast {
this.offsetBottom = options.offsetBottom
this.offsetLeft = options.offsetLeft
this.offsetRight = options.offsetRight
this.extraClasses = options.extraClasses

let style = `width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:${this.opacity};`
const classes = ['notification']
const classes = ['notification', this.extraClasses]
if (this.type) classes.push(this.type)
if (this.animate && this.animate.in) {
const animateInClass = `animate__${this.animate.in}`
Expand Down

0 comments on commit 188058a

Please sign in to comment.