1
1
import DynamicIslandWidget from './DynamicIslandWidget.vue' ;
2
2
import dayjs from "dayjs" ;
3
+ import { NotificationState } from "@/widgets/dynamic-island/model/NotificationState" ;
4
+ import { NotificationType } from "@widget-js/core" ;
3
5
4
6
export default {
5
7
title : 'Widget/DynamicIsland' ,
6
8
component : DynamicIslandWidget ,
7
9
argTypes : {
8
- size : { control : 'select' , options : [ 'small' , 'default' , 'large' ] } ,
9
- targetTime : { control : 'date' } ,
10
- type : {
10
+ // size: {control: 'select', options: ['small', 'default', 'large']},
11
+ state : {
11
12
control : 'select' ,
12
- options : [ 'call' , 'countdown' , 'advance-countdown' , 'error' , 'success' , 'warning' , 'info' ] ,
13
- }
13
+ options : [ NotificationState . HIDE , NotificationState . SMALL , NotificationState . NORMAL , NotificationState . LARGE ]
14
+ } ,
14
15
} ,
15
16
} ;
16
17
@@ -25,77 +26,81 @@ const Template = (args: any) => ({
25
26
export const MessageError = Template . bind ( { } )
26
27
// @ts -ignore
27
28
MessageError . args = {
28
- show : true ,
29
- type : 'error' ,
30
- size : 'small' ,
31
- message : "错误信息"
29
+ notification : {
30
+ type : 'error' ,
31
+ message : "错误信息" ,
32
+ } ,
33
+ state : NotificationState . SMALL
32
34
}
33
35
export const MessageInfo = Template . bind ( { } )
34
36
// @ts -ignore
35
37
MessageInfo . args = {
36
- show : true ,
37
- type : 'info' ,
38
- size : 'small' ,
39
- message : "Hello World"
38
+ notification : {
39
+ type : 'info' ,
40
+ message : "Hello World" ,
41
+ } ,
42
+ state : NotificationState . SMALL
40
43
}
41
44
export const MessageSuccess = Template . bind ( { } )
42
45
// @ts -ignore
43
46
MessageSuccess . args = {
44
- show : true ,
45
- type : 'success' ,
46
- size : 'small' ,
47
- message : "Hello World"
47
+ notification : {
48
+ type : 'success' ,
49
+ message : "Hello World" ,
50
+ } ,
51
+ state : NotificationState . SMALL ,
48
52
}
49
53
50
54
export const MessageWarning = Template . bind ( { } )
51
55
// @ts -ignore
52
56
MessageWarning . args = {
53
- show : true ,
54
- type : 'warning' ,
55
- size : 'small' ,
56
- message : "警告信息"
57
+ notification : {
58
+ type : 'warning' ,
59
+ message : "警告信息" ,
60
+ } ,
61
+ state : NotificationState . SMALL ,
57
62
}
58
63
59
64
export const Countdown = Template . bind ( { } )
60
65
const date = dayjs ( '2023-01-01' ) ;
61
66
62
67
// @ts -ignore
63
68
Countdown . args = {
64
- show : true ,
65
- type : 'countdown' ,
66
- size : 'small' ,
67
- message : '新年倒计时' ,
68
- targetTime : date . toISOString ( ) ,
69
+ notification : {
70
+ type : 'countdown' ,
71
+ message : "新年倒计时" ,
72
+ backgroundColor : "rgba(0,0,0,0.5)" ,
73
+ targetTime : date . toISOString ( ) ,
74
+ } ,
75
+ state : NotificationState . SMALL ,
69
76
}
70
77
71
78
export const CountdownAdvance = Template . bind ( { } )
72
79
// @ts -ignore
73
80
CountdownAdvance . args = {
74
- show : true ,
75
- type : 'advance-countdown' ,
76
- size : 'default' ,
77
- message : '恭喜发财' ,
78
- title : '新年倒计时' ,
79
- targetTime : date . toISOString ( ) ,
80
- }
81
-
82
- export const Call = Template . bind ( { } )
83
- // @ts -ignore
84
- Call . args = {
85
- show : true ,
86
- type : 'call' ,
87
- size : 'default' ,
88
- message : '下班提醒' ,
89
- title : '章鱼哥' ,
81
+ notification : {
82
+ type : 'advance-countdown' ,
83
+ title : "新年倒计时" ,
84
+ message : '恭喜发财' ,
85
+ backgroundColor : "rgba(0,0,0,0.5)" ,
86
+ targetTime : date . toISOString ( ) ,
87
+ } ,
88
+ state : NotificationState . NORMAL ,
90
89
}
91
90
92
91
93
- export const Alert = Template . bind ( { } )
92
+ export const Reminder = Template . bind ( { } )
94
93
// @ts -ignore
95
- Alert . args = {
96
- show : true ,
97
- type : 'alert' ,
98
- size : 'large' ,
99
- message : '您已经连续使用电脑45分钟' ,
100
- title : '久坐提醒' ,
94
+ Reminder . args = {
95
+ state : NotificationState . LARGE ,
96
+ notification : {
97
+ type : "reminder" ,
98
+ message : '您已经连续使用电脑45分钟' ,
99
+ state : NotificationState . LARGE ,
100
+ title : '久坐提醒' ,
101
+ icon : 'computer_line' ,
102
+ color : '#5D8AC8' ,
103
+ cancelButtonText :"知道了" ,
104
+ confirmButtonText :"休息一下" ,
105
+ }
101
106
}
0 commit comments