Skip to content

Commit

Permalink
Upgrade to 1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksi-magner committed Jan 5, 2023
1 parent f708cfd commit 0db9bf5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ yarn add purejs-notify

Main CSS class used for styling.

### additionalClasses

* Type: String
* Default: ''

Additional CSS classes used for styling. Are added to the root element of each notification.

Example classes for styling: `class-1 class-2 class-3`.

### duration

* Type: Number
Expand Down Expand Up @@ -79,13 +88,15 @@ By default, only basic styles and padding are set, without affecting the differe
```javascript
// app/config/notify.js
import { init } from 'purejs-notify';

// Include the core styling file
import 'purejs-notify/style.min.css';

init({
class: 'my-notify',
additionalClasses: 'class-1 class-2 class-3',
duration: 5000,
state: {
class: 'my-notify',
duration: 5000,
success: 'success',
info: 'info',
warning: 'warning',
Expand Down
4 changes: 2 additions & 2 deletions dist/notify.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ class Notify {
render({ message, state, icon }) {
const newMessages = document.createElement('div');
const notifyClass = this.options.class;
const additionalClasses = this.options.additionalClasses.split(' ').filter(Boolean);

newMessages.classList.add(notifyClass);
newMessages.classList.add(notifyClass, ...additionalClasses);

if (state) {
newMessages.classList.add(`${notifyClass}--${state}`);
Expand Down Expand Up @@ -81,6 +82,7 @@ let $error = () => {};
const init = options => {
const notify = new Notify({
class: options?.class || 'notify',
additionalClasses: options?.additionalClasses || '',
duration: options?.duration || 6000,
});

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,7 +1,7 @@
{
"name": "purejs-notify",
"author": "Aleksey Magner",
"version": "1.9.3",
"version": "1.10.0",
"description": "Lightweight pure JS notify plugin.",
"license": "MIT",
"main": "dist/notify.min.js",
Expand Down

0 comments on commit 0db9bf5

Please sign in to comment.