File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed
packages/site/src/routes/demo/snackbar Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Add the below to your _smui-theme.scss file
2
+
3
+ .success .mdc-snackbar__surface {
4
+ background-color : green ;
5
+ }
6
+
7
+ .warning .mdc-snackbar__surface {
8
+ background-color : orange ;
9
+ }
10
+
11
+ .error .mdc-snackbar__surface {
12
+ background-color : red ;
13
+ }
Original file line number Diff line number Diff line change
1
+ <Snackbar bind:this ={snackbarSuccess } class =" success" >
2
+ <Label >{snackbarText }</Label >
3
+ <Actions >
4
+ <IconButton class =" material-icons" title =" Dismiss" >close</IconButton >
5
+ </Actions >
6
+ </Snackbar >
7
+
8
+ <Snackbar bind:this ={snackbarWarning } class =" warning" >
9
+ <Label >{snackbarText }</Label >
10
+ <Actions >
11
+ <IconButton class =" material-icons" title =" Dismiss" >close</IconButton >
12
+ </Actions >
13
+ </Snackbar >
14
+
15
+ <Snackbar bind:this ={snackbarError } class =" error" >
16
+ <Label >{snackbarText }</Label >
17
+ <Actions >
18
+ <IconButton class =" material-icons" title =" Dismiss" >close</IconButton >
19
+ </Actions >
20
+ </Snackbar >
21
+
22
+ <Button on:click ={() => snackbarSuccess && snackbarSuccess .open ()}>
23
+ <Label style =" color:green" >Open Snackbar Success</Label >
24
+ </Button >
25
+
26
+ <Button on:click ={() => snackbarWarning && snackbarWarning .open ()}>
27
+ <Label style =" color:orange" >Open Snackbar Warning</Label >
28
+ </Button >
29
+
30
+ <Button on:click ={() => snackbarError && snackbarError .open ()}>
31
+ <Label style =" color:red" >Open Snackbar Error</Label >
32
+ </Button >
33
+
34
+ <script lang =" ts" >
35
+ import Snackbar , {
36
+ Label ,
37
+ Actions ,
38
+ SnackbarComponentDev ,
39
+ } from ' @smui/snackbar' ;
40
+ import IconButton from ' @smui/icon-button' ;
41
+ import Button from ' @smui/button' ;
42
+
43
+ let snackbarSuccess: SnackbarComponentDev ;
44
+ let snackbarWarning: SnackbarComponentDev ;
45
+ let snackbarError: SnackbarComponentDev ;
46
+
47
+ let snackbarText = ' Snackbar Text' ;
48
+ </script >
You can’t perform that action at this time.
0 commit comments