Skip to content

Commit 85e8674

Browse files
authored
Merge pull request #224 from silinternational/feat/improve-Searchable-Select
improve SearchableSelect story
2 parents 79e4cdd + a685bdb commit 85e8674

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

stories/SearchableSelect.stories.svelte

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script>
2-
import { Meta, Template, Story } from '@storybook/addon-svelte-csf'
3-
import { SearchableSelect } from '../components/custom'
4-
import { Button } from '../components/mdc'
2+
import { SearchableSelect, Form } from '../components/custom'
3+
import { Button, Snackbar, setNotice } from '../components/mdc'
54
import { copyAndModifyArgs } from './helpers.js'
5+
import { Meta, Template, Story } from '@storybook/addon-svelte-csf'
66
77
const args = {
88
options: {
@@ -14,12 +14,11 @@ const args = {
1414
placeholder: 'choice 1',
1515
padding: '12px',
1616
required: false,
17-
choice: 'choice 1',
1817
width: '232px',
1918
maxlength: 255,
20-
'on:chosen': (e) => alert(e.detail + ' chosen (accessed by event.detail)'),
19+
'on:chosen': (e) => setNotice(e.detail + ' chosen (accessed by event.detail)'),
2120
'on:check': (e) => {
22-
!args.options[e.detail] && alert(e.detail + ' not available')
21+
!args.options[e.detail] && setNotice(e.detail + ' not available')
2322
},
2423
class: '', //only works for global classes
2524
}
@@ -28,10 +27,12 @@ const args = {
2827
<Meta title="Atoms/SearchableSelect" component={SearchableSelect} />
2928

3029
<Template let:args>
31-
<form on:submit={() => console.log('submitted')}>
30+
<Form on:submit={() => setNotice('submitted')}>
3231
<SearchableSelect {...args} on:chosen={args['on:chosen']} on:check={args['on:check']} />
3332
<Button>Submit</Button>
34-
</form>
33+
</Form>
34+
35+
<Snackbar />
3536
</Template>
3637

3738
<Story name="Default" {args} />

0 commit comments

Comments
 (0)