NotificationToast.svelte 938 B

12345678910111213141516171819202122232425262728293031323334
  1. <script lang="ts">
  2. import DOMPurify from 'dompurify';
  3. import { marked } from 'marked';
  4. import { createEventDispatcher } from 'svelte';
  5. const dispatch = createEventDispatcher();
  6. export let onClick: Function = () => {};
  7. export let title: string = 'HI';
  8. export let content: string;
  9. </script>
  10. <button
  11. class="flex gap-3 text-left w-[var(--width)] dark:bg-gray-850 dark:text-white bg-white text-black border border-gray-50 dark:border-gray-800 rounded-xl px-3 py-4"
  12. on:click={() => {
  13. onClick();
  14. dispatch('closeToast');
  15. }}
  16. >
  17. <div class="flex-shrink-0 self-top -translate-y-1">
  18. <img src={'/static/favicon.png'} alt="favicon" class="size-8 rounded-full" />
  19. </div>
  20. <div>
  21. {#if title}
  22. <div class=" text-[13px] font-medium mb-0.5 line-clamp-1">{title}</div>
  23. {/if}
  24. <div class=" line-clamp-2 text-xs self-center dark:text-gray-300 font-normal">
  25. {@html DOMPurify.sanitize(marked(content))}
  26. </div>
  27. </div>
  28. </button>