-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlyModal.js
114 lines (106 loc) · 3.2 KB
/
FlyModal.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var modalFactory = require('./modalFactory');
var insertKeyframesRule = require('domkit/insertKeyframesRule');
var appendVendorPrefix = require('domkit/appendVendorPrefix');
var animation = {
show: {
animationDuration: '0.5s',
animationTimingFunction: 'ease-out'
},
hide: {
animationDuration: '0.5s',
animationTimingFunction: 'ease-out'
},
showContentAnimation: insertKeyframesRule({
'0%': {
opacity: 0,
transform: 'translate3d(calc(-100vw - 50%), 0, 0)'
},
'50%': {
opacity: 1,
transform: 'translate3d(100px, 0, 0)'
},
'100%': {
opacity: 1,
transform: 'translate3d(0, 0, 0)'
}
}),
hideContentAnimation: insertKeyframesRule({
'0%': {
opacity: 1,
transform: 'translate3d(0, 0, 0)'
},
'50%': {
opacity: 1,
transform: 'translate3d(-100px, 0, 0) scale3d(1.1, 1.1, 1)'
},
'100%': {
opacity: 0,
transform: 'translate3d(calc(100vw + 50%), 0, 0)'
},
}),
showBackdropAnimation: insertKeyframesRule({
'0%': {
opacity: 0
},
'100%': {
opacity: 0.9
},
}),
hideBackdropAnimation: insertKeyframesRule({
'0%': {
opacity: 0.9
},
'90%': {
opactiy: 0.9
},
'100%': {
opacity: 0
}
})
};
var showAnimation = animation.show;
var hideAnimation = animation.hide;
var showContentAnimation = animation.showContentAnimation;
var hideContentAnimation = animation.hideContentAnimation;
var showBackdropAnimation = animation.showBackdropAnimation;
var hideBackdropAnimation = animation.hideBackdropAnimation;
module.exports = modalFactory({
getRef: function(willHidden) {
return 'content';
},
getModalStyle: function(willHidden) {
return appendVendorPrefix({
zIndex: 1050,
position: "fixed",
width: "500px",
transform: "translate3d(-50%, -50%, 0)",
top: "50%",
left: "50%"
})
},
getBackdropStyle: function(willHidden) {
return appendVendorPrefix({
position: "fixed",
top: 0,
right: 0,
bottom: 0,
left: 0,
zIndex: 1040,
backgroundColor: "#373A47",
animationFillMode: 'forwards',
animationDuration: '0.3s',
animationName: willHidden ? hideBackdropAnimation : showBackdropAnimation,
animationTimingFunction: (willHidden ? hideAnimation : showAnimation).animationTimingFunction
});
},
getContentStyle: function(willHidden) {
return appendVendorPrefix({
margin: 0,
backgroundColor: "white",
animationDuration: (willHidden ? hideAnimation : showAnimation).animationDuration,
animationFillMode: 'forwards',
animationName: willHidden ? hideContentAnimation : showContentAnimation,
animationTimingFunction: (willHidden ? hideAnimation : showAnimation).animationTimingFunction
})
}
});