mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
feat(theme): add Theme (#741)
* feat(theme): add Theme * fix(theme): fix broken type test * docs(theme): add examples * docs(theme): add description, update carbon theme link [ci skip] * docs: pre-wrap type code snippet [ci skip]
This commit is contained in:
parent
18c6f03224
commit
fac78ee4aa
18 changed files with 475 additions and 4 deletions
17
docs/src/pages/framed/Theme/Theme.svelte
Normal file
17
docs/src/pages/framed/Theme/Theme.svelte
Normal file
|
@ -0,0 +1,17 @@
|
|||
<script>
|
||||
import {
|
||||
Theme,
|
||||
RadioButtonGroup,
|
||||
RadioButton,
|
||||
} from "carbon-components-svelte";
|
||||
|
||||
let theme = "g90";
|
||||
</script>
|
||||
|
||||
<Theme bind:theme />
|
||||
|
||||
<RadioButtonGroup legendText="Carbon theme" bind:selected="{theme}">
|
||||
{#each ["white", "g10", "g80", "g90", "g100"] as value}
|
||||
<RadioButton labelText="{value}" value="{value}" />
|
||||
{/each}
|
||||
</RadioButtonGroup>
|
17
docs/src/pages/framed/Theme/ThemePersist.svelte
Normal file
17
docs/src/pages/framed/Theme/ThemePersist.svelte
Normal file
|
@ -0,0 +1,17 @@
|
|||
<script>
|
||||
import {
|
||||
Theme,
|
||||
RadioButtonGroup,
|
||||
RadioButton,
|
||||
} from "carbon-components-svelte";
|
||||
|
||||
let theme = "g90";
|
||||
</script>
|
||||
|
||||
<Theme bind:theme persist persistKey="__carbon-theme" />
|
||||
|
||||
<RadioButtonGroup legendText="Carbon theme" bind:selected="{theme}">
|
||||
{#each ["white", "g10", "g80", "g90", "g100"] as value}
|
||||
<RadioButton labelText="{value}" value="{value}" />
|
||||
{/each}
|
||||
</RadioButtonGroup>
|
5
docs/src/pages/framed/Theme/ThemeSelect.svelte
Normal file
5
docs/src/pages/framed/Theme/ThemeSelect.svelte
Normal file
|
@ -0,0 +1,5 @@
|
|||
<script>
|
||||
import { Theme } from "carbon-components-svelte";
|
||||
</script>
|
||||
|
||||
<Theme render="select" />
|
12
docs/src/pages/framed/Theme/ThemeSelectCustom.svelte
Normal file
12
docs/src/pages/framed/Theme/ThemeSelectCustom.svelte
Normal file
|
@ -0,0 +1,12 @@
|
|||
<script>
|
||||
import { Theme } from "carbon-components-svelte";
|
||||
</script>
|
||||
|
||||
<Theme
|
||||
render="select"
|
||||
select="{{
|
||||
themes: ['white', 'g90', 'g100'],
|
||||
labelText: 'Select a theme',
|
||||
inline: true,
|
||||
}}"
|
||||
/>
|
5
docs/src/pages/framed/Theme/ThemeToggle.svelte
Normal file
5
docs/src/pages/framed/Theme/ThemeToggle.svelte
Normal file
|
@ -0,0 +1,5 @@
|
|||
<script>
|
||||
import { Theme } from "carbon-components-svelte";
|
||||
</script>
|
||||
|
||||
<Theme render="toggle" />
|
14
docs/src/pages/framed/Theme/ThemeToggleCustom.svelte
Normal file
14
docs/src/pages/framed/Theme/ThemeToggleCustom.svelte
Normal file
|
@ -0,0 +1,14 @@
|
|||
<script>
|
||||
import { Theme } from "carbon-components-svelte";
|
||||
</script>
|
||||
|
||||
<Theme
|
||||
render="toggle"
|
||||
toggle="{{
|
||||
themes: ['g10', 'g80'],
|
||||
labelA: 'Enable dark mode',
|
||||
labelB: 'Enable dark mode',
|
||||
hideLabel: true,
|
||||
size: 'sm',
|
||||
}}"
|
||||
/>
|
14
docs/src/pages/framed/Theme/ThemeTokens.svelte
Normal file
14
docs/src/pages/framed/Theme/ThemeTokens.svelte
Normal file
|
@ -0,0 +1,14 @@
|
|||
<script>
|
||||
import { Theme, Button } from "carbon-components-svelte";
|
||||
</script>
|
||||
|
||||
<Theme
|
||||
theme="g90"
|
||||
tokens="{{
|
||||
'interactive-01': '#d02670',
|
||||
'hover-primary': '#ee5396',
|
||||
'active-primary': '#9f1853',
|
||||
}}"
|
||||
/>
|
||||
|
||||
<Button>Primary button</Button>
|
Loading…
Add table
Add a link
Reference in a new issue