Added toast and copy to clipboard functionality

This commit is contained in:
Mike Conrad
2023-08-27 20:26:25 -04:00
parent 1a00388229
commit 47d7b7ba02
7 changed files with 59 additions and 18 deletions

14
src/toast.ts Normal file
View File

@ -0,0 +1,14 @@
export function toast(element: HTMLDivElement, message: string) {
// Target our predefined DIV that will hold toast messages.
const toastDiv = element.getElementsByClassName('toast')
// If we currently have a toast displayed, let's remove it from the DOM.
if (toastDiv && toastDiv.length != 0) {
for (const el of toastDiv){
el.remove()
}
}
// Finally add our toast message.
element.innerHTML += `<div class='toast'>${message}</div>`
}