refactor: use $$restProps API

- add ref prop for applicable components (#196)
- add slot to Content Switcher `Switch` component (#183)
- remove fillArray, css utilities
This commit is contained in:
Eric Liu 2020-07-18 20:00:20 -07:00
commit e886d772c7
288 changed files with 4681 additions and 4498 deletions

View file

@ -1,11 +1,13 @@
<script>
export let story = undefined;
import Layout from '../../internal/ui/Layout.svelte';
import ContentSwitcher from './ContentSwitcher.svelte';
import Switch from './Switch.svelte';
import Layout from "../../internal/ui/Layout.svelte";
import ContentSwitcher from "./ContentSwitcher.svelte";
import Switch from "./Switch.svelte";
import Add16 from "carbon-icons-svelte/lib/Add16";
let selectedIndex = 0;
$: selectedIndex = 0;
$: console.log("bind selectedIndex", selectedIndex);
</script>
<Layout>
@ -26,7 +28,19 @@
}}>
<Switch {...$$props} text="First section" />
<Switch {...$$props} text="Second section" />
<Switch {...$$props} text="Third section" />
<Switch {...$$props}>
<div style="display: flex; align-items:center;">
<Add16 style="margin-right: .25rem;" />
Third section
</div>
</Switch>
</ContentSwitcher>
<div
style="margin-top: 1.5rem"
on:click={() => {
selectedIndex = 1;
}}>
Programmatically set to second index
</div>
{/if}
</Layout>