Skip to content

Commit

Permalink
Merge pull request #29 from mickelsonmichael/positioning-center
Browse files Browse the repository at this point in the history
Add options for center positioning
  • Loading branch information
mickelsonmichael authored Feb 10, 2021
2 parents 8b6c9f0 + e84ea41 commit a088775
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To customize a Snackbar, pass the function a JS object with any of the following
| status | `string` | | Possible statuses include "success", "green", "warning", "alert", "orange", "danger", "error", "red." All other values will default to the blue "info" status|
| actions | `array` | `[]` | See [Actions](#actions)|
| fixed | `boolean` | `false` | `true` indicates a `positioning:fixed;` be added to the container|
| position | `string` | `"br"` | Possible values are "br", "tr", "tl", or "bl"|
| position | `string` | `"br"` | Possible values are `"br"`, `"tr"`, `"tc"`, `"tm"`, `"bc"`, `"bm"`, `"tl"`, or `"bl"` |
| container | `DOMNode` or `string`| `document.body` | If a string is provided, the string is passed to `querySelector` to find the container|
| width | `string` | | Any valid CSS value for `width` |
| speed | `string` or `number` | | Any valid CSS value for `transition-duration` or a duration in milliseconds |
Expand Down
16 changes: 16 additions & 0 deletions dist/js-snackbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
left: 0;
}

.js-snackbar-container--top-center {
top: 0;
bottom: unset;
left: 50%;
right: unset;
transform: translateX(-50%);
}

.js-snackbar-container--top-right {
bottom: unset;
right: 0;
Expand All @@ -31,6 +39,14 @@
top: unset;
}

.js-snackbar-container--bottom-center {
bottom: 0;
right: unset;
left: 50%;
top: unset;
transform: translateX(-50%);
}

.js-snackbar-container--fixed {
position: fixed;
}
Expand Down
8 changes: 8 additions & 0 deletions dist/js-snackbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ function SnackBar(userOptions) {
case "tr":
return "js-snackbar-container--top-right";

case "tc":
case "tm":
return "js-snackbar-container--top-center";

case "bc":
case "bm":
return "js-snackbar-container--bottom-center";

default:
return "js-snackbar-container--bottom-right";
}
Expand Down
4 changes: 2 additions & 2 deletions dist/js-snackbar.min.css

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

Loading

0 comments on commit a088775

Please sign in to comment.