mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
ui: fix message.FLAG_ALERT display
This commit is contained in:
1 parent
13c9e86bd9
commit
71f5f5d8fb
3 files changed
+24
-8
No files matched your search
+22
-6
@@ -12,12 +12,28 @@ export const AppToaster = Toaster.create({
|
||||
className: 'recipe-toaster',
|
||||
position: Position.LEFT_BOTTOM,
|
||||
usePortal: true,
|
||||
}, ToasterContainer);
|
||||
} as any, ToasterContainer);
|
||||
|
||||
interface NotificationOptions {
|
||||
avatar?: string;
|
||||
title?: string;
|
||||
message: string;
|
||||
type?: string;
|
||||
duration?: number;
|
||||
action?: any;
|
||||
}
|
||||
|
||||
export default class Notification {
|
||||
type: string;
|
||||
action: any;
|
||||
$dom: JQuery<HTMLElement>;
|
||||
$n: JQuery<HTMLElement>;
|
||||
duration: number;
|
||||
autoHideTimer?: NodeJS.Timeout;
|
||||
|
||||
constructor({
|
||||
avatar, title, message, type = '', duration = 3000, action,
|
||||
}) {
|
||||
}: NotificationOptions) {
|
||||
this.type = type;
|
||||
if (avatar) this.type += ' avatar';
|
||||
if (title) this.type += ' title';
|
||||
@@ -49,19 +65,19 @@ export default class Notification {
|
||||
setTimeout(() => this.$n.remove(), 200);
|
||||
}
|
||||
|
||||
static success(message, duration) {
|
||||
static success(message: string, duration?: number) {
|
||||
return AppToaster.show({ message, timeout: duration, intent: Intent.SUCCESS });
|
||||
}
|
||||
|
||||
static info(message, duration) {
|
||||
static info(message: string, duration?: number) {
|
||||
return AppToaster.show({ message, timeout: duration, intent: Intent.PRIMARY });
|
||||
}
|
||||
|
||||
static warn(message, duration) {
|
||||
static warn(message: string, duration?: number) {
|
||||
return AppToaster.show({ message, timeout: duration, intent: Intent.WARNING });
|
||||
}
|
||||
|
||||
static error(message, duration) {
|
||||
static error(message: string, duration?: number) {
|
||||
return AppToaster.show({ message, timeout: duration, intent: Intent.DANGER });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user