Skip to content

Commit c42b6c4

Browse files
authored
Merge pull request #24 from silinternational/feature/Snackbar-story
Snackbar story
2 parents 522b11f + eb076a7 commit c42b6c4

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-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 and List so they can accept global classes
13+
- $$props.class to Fab, TextArea, Select, Checkbox, Datatable, Dialog.Simple, Dialog.Alert, Tooltip, Snackbar 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/Snackbar/Snackbar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function open(msg) {
4646
</script>
4747

4848
<div class="mdc-snackbar" bind:this={element}>
49-
<div class="mdc-snackbar__surface mdc-theme--secondary-variant">
49+
<div class="mdc-snackbar__surface mdc-theme--secondary-variant {$$props.class}">
5050
<div class="mdc-snackbar__label" role="status" aria-live="polite">
5151
</div>
5252
{#if action}

stories/Snackbar.stories.svelte

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script>
2+
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"
3+
import { Snackbar, setNotice } from "../components/mdc"
4+
import { onMount } from "svelte"
5+
6+
const args = {
7+
class: '', //only works for global classes
8+
}
9+
10+
onMount(() => {
11+
setTimeout(
12+
() => setNotice('Here is a notice set by the setNotice function'), 2000
13+
)
14+
})
15+
</script>
16+
17+
<Meta
18+
title="Atoms/Snackbar"
19+
component={Snackbar}
20+
/>
21+
22+
<Template let:args>
23+
<Snackbar {...args}/>
24+
</Template>
25+
26+
<Story
27+
name="Default"
28+
{args}
29+
/>

0 commit comments

Comments
 (0)