mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
docs: build carbon themes using sass
This commit is contained in:
parent
9aa01ce5fb
commit
e2c8ea6d76
10 changed files with 808 additions and 28 deletions
|
@ -7,8 +7,9 @@
|
|||
HeaderNav,
|
||||
HeaderNavItem,
|
||||
HeaderUtilities,
|
||||
HeaderActionLink
|
||||
HeaderActionLink,
|
||||
} from "carbon-components-svelte";
|
||||
import Theme from "./Theme.svelte";
|
||||
</script>
|
||||
|
||||
<Header
|
||||
|
|
29
docs/src/components/Theme.svelte
Normal file
29
docs/src/components/Theme.svelte
Normal file
|
@ -0,0 +1,29 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { Select, SelectItem } from "carbon-components-svelte";
|
||||
|
||||
let theme = undefined;
|
||||
|
||||
onMount(() => {
|
||||
theme = localStorage.getItem("theme") || "g10";
|
||||
});
|
||||
|
||||
$: if (theme) {
|
||||
localStorage.setItem("theme", theme);
|
||||
document.documentElement.setAttribute("carbon-theme", theme);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
:global(.bx--select-input) {
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<Select inline labelText="Theme" bind:selected={theme}>
|
||||
<SelectItem value="white" text="White" />
|
||||
<SelectItem value="g10" text="Gray 10" />
|
||||
<SelectItem value="g90" text="Gray 90" />
|
||||
<SelectItem value="g100" text="Gray 100" />
|
||||
</Select>
|
Loading…
Add table
Add a link
Reference in a new issue