ember flash notifications
v0.1.4
تم تصميم الملحق لعرض إشعارات الفلاش ضمن تطبيقات ember.js. مدعوم من Popover API.
ember install ember-flash-notifications
أضف FlashNotifications الاحتجاج إلى قالب:
<FlashNotifications as |notification|>
<FlashNotification @notification={{notification}}>
<div class={{notification.type}}>{{notification.message}}</div>
</FlashNotification>
</FlashNotifications>
أضف الحد الأدنى من الأنماط المطلوبة لعنصر الإخطار (Tailwindcss ليس اعتمادًا على ذلك ، وتكون قادرًا على استخدام CSS العادي أيضًا):
[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;
}
}
... وجعل الاحتجاج الإخطار:
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!');
}
}
انظر أمثلة مفصلة ، و documetation API والأمثلة الحية هنا
انظر دليل المساهمة للحصول على التفاصيل.
هذا المشروع مرخص بموجب ترخيص معهد ماساتشوستس للتكنولوجيا.