Skip to content

Commit f582dba

Browse files
authored
Merge pull request #25 from silinternational/feature/TabBar-story
TabBar story
2 parents c42b6c4 + 4da6efa commit f582dba

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Added
1212
- actions, isAboveMobile, isAboveTablet, setNotice to index.js so they can be imported directly
13-
- $$props.class to Fab, TextArea, Select, Checkbox, Datatable, Dialog.Simple, Dialog.Alert, Tooltip, Snackbar and List so they can accept global classes
13+
- $$props.class to Fab, TextArea, Select, Checkbox, Datatable, Dialog.Simple, Dialog.Alert, Tooltip, Snackbar, TabBar and List so they can accept global classes
1414
- barColorProvided to Progress.Linear to allow bypass of bar-color class when no color is provided
1515
- bgColorIsVariant to TopAppBar to allow bypass of bg-color-variant if no color is provided
1616
- README: Theming, Drawer example, CSS utility classes and Storybook url.

components/mdc/TabBar/TabBar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ onMount(() => {
2323
}
2424
</style>
2525

26-
<div class="mdc-tab-bar" role="tablist" bind:this={element}>
26+
<div class="mdc-tab-bar {$$props.class}" role="tablist" bind:this={element}>
2727
<slot />
2828
</div>

stories/TabBar.stories.svelte

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script>
2+
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"
3+
import { TabBar } from "../components/mdc"
4+
5+
const args = {
6+
tab: 0,
7+
onClick: () => {},
8+
class: '' //only works for global classes
9+
}
10+
</script>
11+
12+
<Meta
13+
title="Atoms/TabBar"
14+
component={TabBar}
15+
/>
16+
17+
<Template let:args>
18+
<TabBar {...args}>
19+
<TabBar.Scroller>
20+
<TabBar.Tab label="tab 1" on:click={args.onClick} active={args.tab === 0} />
21+
<TabBar.Tab label="tab 2" on:click={args.onClick} active={args.tab === 1} />
22+
<TabBar.Tab label="tab 3" on:click={args.onClick} active={args.tab === 2} />
23+
</TabBar.Scroller>
24+
</TabBar>
25+
</Template>
26+
27+
<Story
28+
name="Default"
29+
{args}
30+
/>

0 commit comments

Comments
 (0)