MDL-66828 core: Add toast-style notifications

Part of MDL-66074
This commit is contained in:
Andrew Nicols 2019-10-03 09:39:39 +08:00 committed by Mathew May
parent b253a4f21d
commit 224ea04e68
15 changed files with 135 additions and 1 deletions

View file

@ -0,0 +1,21 @@
<div id="toast-{{uniqid}}" class="toast bg-dark text-white rounded mx-auto" data-delay="{{delay}}" {{^autohide}}data-autohide="false"{{/autohide}}>
<div class="toast-body">
<span>{{{message}}}</span>
{{#closeButton}}
<button type="button" class="ml-2 mb-1 close text-white" data-dismiss="toast" aria-label="{{#str}}dismissnotification, core{{/str}}">
<span aria-hidden="true">&times;</span>
</button>
{{/closeButton}}
</div>
</div>
{{#js}}
require(['jquery', 'theme_boost/toast'], function(jQuery) {
// Show the toast.
// Bootstrap toast components are not shown automatically.
jQuery('#toast-{{uniqid}}').toast('show');
jQuery('#toast-{{uniqid}}').on('hidden.bs.toast', function(e) {
e.target.remove();
});
});
{{/js}}

View file

@ -0,0 +1 @@
<div class="toast-wrapper mx-auto py-3 fixed-top" role="status" aria-live="polite"></div>