source: src/components/custom-popover/utils.ts@ 5d6f37a

main
Last change on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 2.9 KB
Line 
1// ----------------------------------------------------------------------
2
3export function getPosition(arrow: string) {
4 let props;
5
6 switch (arrow) {
7 case 'top-left':
8 props = {
9 style: { ml: -0.75 },
10 anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
11 transformOrigin: { vertical: 'top', horizontal: 'left' },
12 };
13 break;
14 case 'top-center':
15 props = {
16 style: {},
17 anchorOrigin: { vertical: 'bottom', horizontal: 'center' },
18 transformOrigin: { vertical: 'top', horizontal: 'center' },
19 };
20 break;
21 case 'top-right':
22 props = {
23 style: { ml: 0.75 },
24 anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
25 transformOrigin: { vertical: 'top', horizontal: 'right' },
26 };
27 break;
28 case 'bottom-left':
29 props = {
30 style: { ml: -0.75 },
31 anchorOrigin: { vertical: 'top', horizontal: 'left' },
32 transformOrigin: { vertical: 'bottom', horizontal: 'left' },
33 };
34 break;
35 case 'bottom-center':
36 props = {
37 style: {},
38 anchorOrigin: { vertical: 'top', horizontal: 'center' },
39 transformOrigin: { vertical: 'bottom', horizontal: 'center' },
40 };
41 break;
42 case 'bottom-right':
43 props = {
44 style: { ml: 0.75 },
45 anchorOrigin: { vertical: 'top', horizontal: 'right' },
46 transformOrigin: { vertical: 'bottom', horizontal: 'right' },
47 };
48 break;
49 case 'left-top':
50 props = {
51 style: { mt: -0.75 },
52 anchorOrigin: { vertical: 'top', horizontal: 'right' },
53 transformOrigin: { vertical: 'top', horizontal: 'left' },
54 };
55 break;
56 case 'left-center':
57 props = {
58 anchorOrigin: { vertical: 'center', horizontal: 'right' },
59 transformOrigin: { vertical: 'center', horizontal: 'left' },
60 };
61 break;
62 case 'left-bottom':
63 props = {
64 style: { mt: 0.75 },
65 anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
66 transformOrigin: { vertical: 'bottom', horizontal: 'left' },
67 };
68 break;
69 case 'right-top':
70 props = {
71 style: { mt: -0.75 },
72 anchorOrigin: { vertical: 'top', horizontal: 'left' },
73 transformOrigin: { vertical: 'top', horizontal: 'right' },
74 };
75 break;
76 case 'right-center':
77 props = {
78 anchorOrigin: { vertical: 'center', horizontal: 'left' },
79 transformOrigin: { vertical: 'center', horizontal: 'right' },
80 };
81 break;
82 case 'right-bottom':
83 props = {
84 style: { mt: 0.75 },
85 anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
86 transformOrigin: { vertical: 'bottom', horizontal: 'right' },
87 };
88 break;
89
90 // top-right
91 default:
92 props = {
93 style: { ml: 0.75 },
94 anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
95 transformOrigin: { vertical: 'top', horizontal: 'right' },
96 };
97 }
98
99 return props;
100}
Note: See TracBrowser for help on using the repository browser.