-
-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy path_Kitchen.svelte
More file actions
45 lines (39 loc) · 1.09 KB
/
_Kitchen.svelte
File metadata and controls
45 lines (39 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<Kitchen bind:this={kitchen} dismiss$class="material-icons" />
<Button onclick={pushToKitchen}><Label>Push a New Snackbar</Label></Button>
<pre class="status">Closed Reason: {reason}</pre>
<pre class="status">Action: {action}</pre>
<script module lang="ts">
let counter = 0;
</script>
<script lang="ts">
import Kitchen from '@smui/snackbar/kitchen';
import Button, { Label } from '@smui/button';
let kitchen: Kitchen;
let reason = $state('nothing yet');
let action = $state('nothing yet');
function pushToKitchen() {
kitchen.push({
props: {
variant: 'stacked',
},
label:
"This is a snackbar generated by the kitchen. Here's a counter: " +
++counter,
actions: [
{
onClick: () => (action = 'Something'),
text: 'Something',
},
{
onClick: () => (action = 'Another'),
text: 'Another',
},
],
dismissButton: true,
onDismiss: () => (action = 'Dismissed'),
onClose: (e) => {
reason = e.detail.reason ?? 'Undefined.';
},
});
}
</script>