This commit is contained in:
Alan Grainger 2023-09-12 17:10:38 +02:00
parent 51b32a5245
commit d9bc486af9
2 changed files with 13 additions and 9 deletions

View file

@ -9,20 +9,17 @@ export enum StatusType {
}
interface StatusAttributes {
background: string;
color: string;
class: string;
icon: string;
}
const statuses: { [key: number]: StatusAttributes } = {
[StatusType.Error]: {
background: '#c10000',
color: 'white',
class: 'share-note-status-error',
icon: '❌ '
},
[StatusType.Success]: {
background: '#4c864c',
color: 'white',
class: 'share-note-status-success',
icon: '✔ '
}
}
@ -36,10 +33,8 @@ export default class StatusMessage extends Notice {
})
super(messageDoc, duration)
if (messageEl.parentElement) {
const style = messageEl.parentElement.style
if (statuses[type]) {
style.background = statuses[type].background
style.color = statuses[type].color
messageEl.parentElement.classList.add(statuses[type].class)
}
}
}

9
styles.css Normal file
View file

@ -0,0 +1,9 @@
.share-note-status-error {
background: #c10000;
color: white
}
.share-note-status-success {
background: #4c864c;
color: white
}