Skip to content

Commit

Permalink
Fixed snackbar button without class bug
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithkyle committed Sep 16, 2020
1 parent 35a9e79 commit b9b4d61
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.3] - 2020-09-16

### Fixed

- snackbar button without class string/array bug

## [2.0.1] - 2020-04-24

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codewithkyle/notifyjs",
"version": "2.0.2",
"version": "2.0.3",
"description": "A simple JavaScript library for creating and managing toaster & snackbar notifications",
"main": "notify.js",
"files": [
Expand Down
12 changes: 9 additions & 3 deletions src/notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,15 @@ export class Notifier {
}
snackbar.buttons = buttons;
for (let i = 0; i < snackbar.buttons.length; i++) {
if (snackbar.buttons[i]?.classes && !Array.isArray(snackbar.buttons[i]?.classes)) {
// @ts-ignore
snackbar.buttons[i].classes = [snackbar.buttons[i].classes];
if (snackbar.buttons[i]?.classes) {
if (!Array.isArray(snackbar.buttons[i].classes)) {
// @ts-ignore
snackbar.buttons[i].classes = [snackbar.buttons[i].classes];
} else {
snackbar.buttons[i].classes = snackbar.buttons[i].classes;
}
} else {
snackbar.buttons[i].classes = [];
}
if (!snackbar.buttons[i]?.ariaLabel) {
snackbar.buttons[i].ariaLabel = null;
Expand Down

0 comments on commit b9b4d61

Please sign in to comment.