diff --git a/src/StatusMessage.ts b/src/StatusMessage.ts index c8d7b83..b13d71d 100644 --- a/src/StatusMessage.ts +++ b/src/StatusMessage.ts @@ -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) } } } diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..f2ab416 --- /dev/null +++ b/styles.css @@ -0,0 +1,9 @@ +.share-note-status-error { + background: #c10000; + color: white +} + +.share-note-status-success { + background: #4c864c; + color: white +}