Embeds.svelte 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script>
  2. import { embed, showControls, showEmbeds } from '$lib/stores';
  3. import FullHeightIframe from '$lib/components/common/FullHeightIframe.svelte';
  4. import XMark from '$lib/components/icons/XMark.svelte';
  5. export let overlay = false;
  6. </script>
  7. {#if $embed}
  8. <div class="h-full w-full">
  9. <div
  10. class="pointer-events-auto z-20 flex justify-between items-center py-3 px-2 font-primar text-gray-900 dark:text-white"
  11. >
  12. <div class="flex-1 flex items-center justify-between pl-2">
  13. <div class="flex items-center space-x-2">
  14. {$embed?.title ?? 'Embedded Content'}
  15. </div>
  16. </div>
  17. <button
  18. class="self-center pointer-events-auto p-1 rounded-full bg-white dark:bg-gray-850"
  19. on:click={() => {
  20. showControls.set(false);
  21. showEmbeds.set(false);
  22. embed.set(null);
  23. }}
  24. >
  25. <XMark className="size-3.5 text-gray-900 dark:text-white" />
  26. </button>
  27. </div>
  28. <div class=" w-full h-full relative">
  29. {#if overlay}
  30. <div class=" absolute top-0 left-0 right-0 bottom-0 z-10"></div>
  31. {/if}
  32. <FullHeightIframe src={$embed?.url} iframeClassName="w-full h-full" />
  33. </div>
  34. </div>
  35. {/if}