mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
docs(preview): append current theme to iframe url
This commit is contained in:
parent
c76fa8c432
commit
4d89c83723
1 changed files with 9 additions and 6 deletions
|
@ -7,8 +7,10 @@
|
||||||
import { CodeSnippet, Button } from "carbon-components-svelte";
|
import { CodeSnippet, Button } from "carbon-components-svelte";
|
||||||
import Launch16 from "carbon-icons-svelte/lib/Launch16";
|
import Launch16 from "carbon-icons-svelte/lib/Launch16";
|
||||||
import copy from "clipboard-copy";
|
import copy from "clipboard-copy";
|
||||||
import { url, beforeUrlChange } from "@sveltech/routify";
|
import { url } from "@sveltech/routify";
|
||||||
import { theme } from "../store";
|
import { theme } from "../store";
|
||||||
|
|
||||||
|
$: themedSrcUrl = $url(`${src}?theme=${$theme}`);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style global>
|
<style global>
|
||||||
|
@ -84,6 +86,10 @@
|
||||||
color: #bb8eff;
|
color: #bb8eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.token.number {
|
||||||
|
color: #a7f0ba;
|
||||||
|
}
|
||||||
|
|
||||||
.token.comment {
|
.token.comment {
|
||||||
color: #bebebe;
|
color: #bebebe;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +144,7 @@
|
||||||
kind="ghost"
|
kind="ghost"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
size="field"
|
size="field"
|
||||||
href="{$url(src)}"
|
href="{themedSrcUrl}"
|
||||||
icon="{Launch16}"
|
icon="{Launch16}"
|
||||||
>
|
>
|
||||||
Open in new tab
|
Open in new tab
|
||||||
|
@ -147,10 +153,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
<div class="preview-viewer" class:framed>
|
<div class="preview-viewer" class:framed>
|
||||||
{#if framed}
|
{#if framed}
|
||||||
<iframe
|
<iframe title="{src.split('/').pop()}" src="{themedSrcUrl}"></iframe>
|
||||||
title="{src.split('/').pop()}"
|
|
||||||
src="{$url(`${src}?theme=${$theme}`)}"
|
|
||||||
></iframe>
|
|
||||||
{:else}
|
{:else}
|
||||||
<slot />
|
<slot />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue