mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 16:14:25 +03:00
7356bfbcd9
refs e021843e3f
- fixed closing of alerts due to missing `.args` after migrating to glimmer syntax
- updated related tests for glimmer component syntax
31 lines
710 B
JavaScript
31 lines
710 B
JavaScript
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]}`;
|
|
}
|
|
|
|
return classes;
|
|
}
|
|
|
|
@action
|
|
closeNotification() {
|
|
this.notifications.closeNotification(this.args.message);
|
|
}
|
|
}
|