File tree Expand file tree Collapse file tree 2 files changed +13
-19
lines changed
src/routes/components/facets/examples Expand file tree Collapse file tree 2 files changed +13
-19
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import { writable } from ' svelte/store' ;
3
+
2
4
import CodeContainer from ' $docs/components/CodeContainer.svelte' ;
3
5
import Facets from ' $lib/components/Facets/Facets.svelte' ;
4
6
import { facetsNoGroupSelectionData , facetsGroupSelectionSvelte } from ' ../data/codeBlocks' ;
5
7
import { groups } from ' ../data/data' ;
6
8
7
- let selected = {
8
- Mediums: [],
9
- Genres: [],
10
- Authors: []
11
- };
12
-
13
- let selectedGroups = {
14
- Mediums: true ,
15
- Genres: false ,
16
- Authors: false
17
- };
9
+ const groupsStore = writable (groups );
18
10
</script >
19
11
20
12
<div id =" facetsGroupSelection" >
23
15
svelte ={facetsGroupSelectionSvelte }
24
16
data ={facetsNoGroupSelectionData }
25
17
>
26
- <Facets { groups } bind:selected bind:selectedGroups groupSelection open />
18
+ <Facets groups ={ groupsStore } groupSelection open on:change ={( e ) => console . log ( e )} />
27
19
</CodeContainer >
28
20
</div >
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import { writable } from ' svelte/store' ;
3
+
2
4
import CodeContainer from ' $docs/components/CodeContainer.svelte' ;
3
5
import Facets from ' $lib/components/Facets/Facets.svelte' ;
4
6
import { facetsNoGroupSelectionData , facetsNoGroupSelectionSvelte } from ' ../data/codeBlocks' ;
5
7
import { groups } from ' ../data/data' ;
6
8
7
- let selected = {
8
- Mediums: [],
9
- Genres: [],
10
- Authors: []
11
- };
9
+ const groupsStore = writable (groups );
12
10
</script >
13
11
14
12
<div id =" facetsNoGroupSelection" >
15
- <CodeContainer title ="No group selection, closed by default and all options displayed in UI" svelte ={facetsNoGroupSelectionSvelte } data ={facetsNoGroupSelectionData }>
16
- <Facets {groups } bind:selected showAll />
13
+ <CodeContainer
14
+ title =" No group selection, closed by default and all options displayed in UI"
15
+ svelte ={facetsNoGroupSelectionSvelte }
16
+ data ={facetsNoGroupSelectionData }
17
+ >
18
+ <Facets groups ={groupsStore } showAll on:change ={(e ) => console .log (e )} />
17
19
</CodeContainer >
18
20
</div >
You can’t perform that action at this time.
0 commit comments