mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +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 Launch16 from "carbon-icons-svelte/lib/Launch16";
|
||||
import copy from "clipboard-copy";
|
||||
import { url, beforeUrlChange } from "@sveltech/routify";
|
||||
import { url } from "@sveltech/routify";
|
||||
import { theme } from "../store";
|
||||
|
||||
$: themedSrcUrl = $url(`${src}?theme=${$theme}`);
|
||||
</script>
|
||||
|
||||
<style global>
|
||||
|
@ -84,6 +86,10 @@
|
|||
color: #bb8eff;
|
||||
}
|
||||
|
||||
.token.number {
|
||||
color: #a7f0ba;
|
||||
}
|
||||
|
||||
.token.comment {
|
||||
color: #bebebe;
|
||||
}
|
||||
|
@ -138,7 +144,7 @@
|
|||
kind="ghost"
|
||||
target="_blank"
|
||||
size="field"
|
||||
href="{$url(src)}"
|
||||
href="{themedSrcUrl}"
|
||||
icon="{Launch16}"
|
||||
>
|
||||
Open in new tab
|
||||
|
@ -147,10 +153,7 @@
|
|||
{/if}
|
||||
<div class="preview-viewer" class:framed>
|
||||
{#if framed}
|
||||
<iframe
|
||||
title="{src.split('/').pop()}"
|
||||
src="{$url(`${src}?theme=${$theme}`)}"
|
||||
></iframe>
|
||||
<iframe title="{src.split('/').pop()}" src="{themedSrcUrl}"></iframe>
|
||||
{:else}
|
||||
<slot />
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue