mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(content-switcher): support light variant
This commit is contained in:
parent
ffa4ac08f3
commit
9a78f9900d
3 changed files with 10 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
export let story = undefined;
|
export let story = undefined;
|
||||||
|
export let light = false;
|
||||||
|
|
||||||
import ContentSwitcher from "./ContentSwitcher.svelte";
|
import ContentSwitcher from "./ContentSwitcher.svelte";
|
||||||
import Switch from "./Switch.svelte";
|
import Switch from "./Switch.svelte";
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
|
|
||||||
{#if story === 'selected'}
|
{#if story === 'selected'}
|
||||||
<ContentSwitcher
|
<ContentSwitcher
|
||||||
|
{light}
|
||||||
on:change={({ detail }) => {
|
on:change={({ detail }) => {
|
||||||
console.log('on:change', detail);
|
console.log('on:change', detail);
|
||||||
}}>
|
}}>
|
||||||
|
@ -20,6 +22,7 @@
|
||||||
</ContentSwitcher>
|
</ContentSwitcher>
|
||||||
{:else}
|
{:else}
|
||||||
<ContentSwitcher
|
<ContentSwitcher
|
||||||
|
{light}
|
||||||
bind:selectedIndex
|
bind:selectedIndex
|
||||||
on:change={({ detail }) => {
|
on:change={({ detail }) => {
|
||||||
console.log('on:change', detail);
|
console.log('on:change', detail);
|
||||||
|
|
|
@ -5,7 +5,10 @@ export default { title: "ContentSwitcher", decorators: [withKnobs] };
|
||||||
|
|
||||||
export const Default = () => ({
|
export const Default = () => ({
|
||||||
Component,
|
Component,
|
||||||
props: { disabled: boolean("Disabled (disabled)", false) },
|
props: {
|
||||||
|
disabled: boolean("Disabled (disabled)", false),
|
||||||
|
light: boolean("Light variant (light)", false),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Selected = () => ({
|
export const Selected = () => ({
|
||||||
|
@ -13,5 +16,6 @@ export const Selected = () => ({
|
||||||
props: {
|
props: {
|
||||||
story: "selected",
|
story: "selected",
|
||||||
disabled: boolean("Disabled (disabled)", false),
|
disabled: boolean("Disabled (disabled)", false),
|
||||||
|
light: boolean("Light variant (light)", false),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
export let selectedIndex = 0;
|
export let selectedIndex = 0;
|
||||||
|
export let light = false;
|
||||||
|
|
||||||
import { afterUpdate, createEventDispatcher, setContext } from "svelte";
|
import { afterUpdate, createEventDispatcher, setContext } from "svelte";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
<div
|
<div
|
||||||
role="tablist"
|
role="tablist"
|
||||||
class:bx--content-switcher={true}
|
class:bx--content-switcher={true}
|
||||||
|
class:bx--content-switcher--light={light}
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue