Skip to content

Commit

Permalink
persist iframe state
Browse files Browse the repository at this point in the history
  • Loading branch information
MCarlomagno committed Dec 12, 2024
1 parent 3c33107 commit 32436ae
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions packages/ui/src/DefenderDeployModal.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
<script lang="ts">
import { fly } from 'svelte/transition';
import { elasticIn } from 'svelte/easing';
const devMode = window.location.href.includes('localhost');
export let isOpen = false;
let loaded = false;
let showIframe = false;
const handleLoad = () => {
loaded = true;
};
$: if (isOpen) {
// Show iframe after modal transition (450ms)
setTimeout(() => {
showIframe = true;
}, 450);
} else {
showIframe = false;
}
</script>

{#if isOpen}
Expand All @@ -24,14 +32,16 @@
Loading...
</div>
{/if}

<iframe
id="defender-deploy"
title="Defender Deploy"
src={devMode ? 'http://localhost:5173' : 'https://defender-deploy-wizard.netlify.app/'}
class={`flex-grow border-none ${!loaded ? 'hidden' : ''}`}
on:load={handleLoad}
/>
</div>
</div>
{/if}
{/if}

<iframe
id="defender-deploy"
title="Defender Deploy"
src={devMode ? 'http://localhost:5173' : 'https://defender-deploy-wizard.netlify.app/'}
class={`fixed z-30 right-3.5 w-[360px] h-[calc(100vh-84px)] border-none
${!showIframe ? 'invisible' : ''}
${!loaded ? 'hidden' : ''}`}
on:load={handleLoad}
/>

0 comments on commit 32436ae

Please sign in to comment.