Skip to content

Commit

Permalink
chore(docs): avoid stale persisted values
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Dec 30, 2023
1 parent 7a644fc commit e238666
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions docs/src/components/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Column,
Content,
Theme,
SelectSkeleton,
} from "carbon-components-svelte";
import FocusKey from "svelte-focus-key";
import fuzzy from "fuzzy";
Expand All @@ -27,9 +28,7 @@
$: filteredModuleNames = pictogramNames.filter((name) =>
match(value.trim().replace(/\s+/g, ""), name)
);
$: if (typeof document !== "undefined") {
document.documentElement.setAttribute("theme", theme);
}
$: mounted = typeof document !== "undefined";
$: code = `<script>\n import ${moduleName} from "carbon-pictograms-svelte/lib/${moduleName}.svelte";\n<\/script>\n\n<${moduleName} />`;
</script>

Expand All @@ -56,18 +55,22 @@
<Row>
<Column>
<div class="flex">
<Theme
bind:theme
persist
render="select"
select={{
id: "select-theme",
size: "xl",
labelText: "Carbon theme",
themes: ["white", "g10", "g80", "g90", "g100"],
}}
/>
{#if mounted}
<Theme
bind:theme
persist
render="select"
select={{
id: "select-theme",
labelText: "Carbon theme",
themes: ["white", "g10", "g80", "g90", "g100"],
}}
/>
{:else}
<SelectSkeleton id="select-theme" />
{/if}
<Search
size="lg"
style="border-left: 1px solid var(--cds-ui-03);"
autocomplete="off"
autocorrect="off"
Expand Down

0 comments on commit e238666

Please sign in to comment.