Ghost/ghost/admin/app/components/gh-alert.js

31 lines
710 B
JavaScript
Raw Normal View History

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
export default class GhAlert extends Component {
@service notifications;
get typeClass() {
const typeMapping = {
success: 'green',
error: 'red',
warn: 'blue',
info: 'blue'
};
const type = this.args.message.type;
let classes = '';
if (typeMapping[type] !== undefined) {
classes += `gh-alert-${typeMapping[type]}`;
2015-05-21 20:03:24 +03:00
}
return classes;
}
2015-05-21 20:03:24 +03:00
@action
closeNotification() {
this.notifications.closeNotification(this.args.message);
2015-05-21 20:03:24 +03:00
}
}