ember flash notifications
v0.1.4
El complemento está diseñado para mostrar notificaciones flash dentro de las aplicaciones Ember.js. Impulsado por la API de Popover.
ember install ember-flash-notifications
Agregar invocación de Notificaciones FlashNotificaciones a una plantilla:
<FlashNotifications as |notification|>
<FlashNotification @notification={{notification}}>
<div class={{notification.type}}>{{notification.message}}</div>
</FlashNotification>
</FlashNotifications>
Agregue estilos mínimos requeridos para un elemento de notificación (Tailwindcss no es una dependencia, y usted también puede usar CSS simple):
[popover] {
@apply my-0 mr-0;
}
.flash {
@apply w-80 border transition-opacity block opacity-0;
}
.flash:popover-open {
@apply opacity-100;
}
.flash .error {
@apply bg-rose-500 text-white p-2 rounded-sm;
}
@starting-style {
.flash:popover-open {
@apply opacity-0;
}
}
... y hacer invocación de notificación:
mport { action } from '@ember/object';
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class FlashComponent extends Component {
@service notifications;
@action
addNotification() {
this.notifications.error('Something is going wrong!');
}
}
Vea ejemplos detallados, documentación de API y ejemplos en vivo aquí
Consulte la guía contribuyente para obtener detalles.
Este proyecto tiene licencia bajo la licencia MIT.