diff options
Diffstat (limited to 'ui/src/utils.ts')
-rw-r--r-- | ui/src/utils.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ui/src/utils.ts b/ui/src/utils.ts index dce746e2..a3aab09d 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -23,6 +23,7 @@ import markdownitEmoji from 'markdown-it-emoji/light'; import markdown_it_container from 'markdown-it-container'; import * as twemoji from 'twemoji'; import * as emojiShortName from 'emoji-short-name'; +import Toastify from 'toastify-js'; export const repoUrl = 'https://github.com/dessalines/lemmy'; export const markdownHelpUrl = 'https://commonmark.org/help/'; @@ -366,3 +367,11 @@ export function imageThumbnailer(url: string): string { export function isCommentType(item: Comment | PrivateMessage): item is Comment { return (item as Comment).community_id !== undefined; } + +export function toast(text: string, background: string = 'success') { + let backgroundColor = `var(--${background})`; + Toastify({ + text: text, + backgroundColor: backgroundColor, + }).showToast(); +} |