mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
refactor(theme-picker): use two-way binding
This commit is contained in:
parent
1802d963ac
commit
45f3a8ca65
1 changed files with 2 additions and 11 deletions
|
@ -19,20 +19,11 @@
|
||||||
|
|
||||||
afterUpdate(() => {
|
afterUpdate(() => {
|
||||||
localStorage.setItem('theme', $theme);
|
localStorage.setItem('theme', $theme);
|
||||||
});
|
|
||||||
|
|
||||||
$: {
|
|
||||||
document.documentElement.setAttribute('carbon-theme', $theme);
|
document.documentElement.setAttribute('carbon-theme', $theme);
|
||||||
}
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select {inline} labelText="Theme" bind:selected={$theme}>
|
||||||
{inline}
|
|
||||||
labelText="Theme"
|
|
||||||
selected={$theme}
|
|
||||||
on:change={({ detail }) => {
|
|
||||||
theme.set(detail);
|
|
||||||
}}>
|
|
||||||
<SelectItem value="white" text="White" />
|
<SelectItem value="white" text="White" />
|
||||||
<SelectItem value="g10" text="Gray 10" />
|
<SelectItem value="g10" text="Gray 10" />
|
||||||
<SelectItem value="g90" text="Gray 90" />
|
<SelectItem value="g90" text="Gray 90" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue