UNPKG

1 kBJavaScriptView Raw
1export function getPlacementStyle(placement, top, bottom) {
2 let style;
3 switch (placement) {
4 case 'top':
5 style = {
6 left: '50%',
7 transform: 'translateX(-50%)',
8 right: 'auto',
9 top,
10 bottom: 'auto'
11 };
12 break;
13 case 'topLeft':
14 style = {
15 left: 0,
16 top,
17 bottom: 'auto'
18 };
19 break;
20 case 'topRight':
21 style = {
22 right: 0,
23 top,
24 bottom: 'auto'
25 };
26 break;
27 case 'bottom':
28 style = {
29 left: '50%',
30 transform: 'translateX(-50%)',
31 right: 'auto',
32 top: 'auto',
33 bottom
34 };
35 break;
36 case 'bottomLeft':
37 style = {
38 left: 0,
39 top: 'auto',
40 bottom
41 };
42 break;
43 default:
44 style = {
45 right: 0,
46 top: 'auto',
47 bottom
48 };
49 break;
50 }
51 return style;
52}
53export function getMotion(prefixCls) {
54 return {
55 motionName: `${prefixCls}-fade`
56 };
57}
\No newline at end of file