@@ -2,89 +2,72 @@ import { StyleSheet } from 'aphrodite-jss'
2
2
/**
3
3
* Generates the tooltip style based on the element-specified "data-type" property.
4
4
*/
5
- export function getTooltipStyle ( textColor , backgroundColor , borderColor ) {
5
+ export function getTooltipStyle ( colors ) {
6
+ const textColor = colors . textColor
7
+ const backgroundColor = colors . backgroundColor
8
+ const arrowColor = colors . arrowColor
6
9
7
10
return StyleSheet . create ( {
8
-
9
11
'__react_component_tooltip' : {
10
12
'color' : textColor ,
11
13
'backgroundColor' : backgroundColor ,
12
- 'border' : '6px solid ' + borderColor ,
13
-
14
14
15
- // TODO: JUST TEST WORKING EXAMPLE - REMOVE WHEN DONE
16
- // '&.place-top' : {
17
- // 'width' : '5000px !important'
18
- // },
19
- // '&.place-top' : {
20
- // 'width' : '6000px !important'
21
- // },
22
- // // TODO: JUST TEST
15
+ '&.place-top' : {
16
+ 'margin-top' : '-10px'
17
+ } ,
18
+ '&.place-top:after' : {
19
+ 'border-left' : '8px solid transparent' ,
20
+ 'border-right' : '8px solid transparent' ,
21
+ 'bottom' : '-6px' ,
22
+ 'left' : '50%' ,
23
+ 'margin-left' : '-8px' ,
24
+ 'border-top-color' : arrowColor ,
25
+ 'border-top-style' : 'solid' ,
26
+ 'border-top-width' : '6px'
27
+ } ,
23
28
24
- '&.place-top' : {
25
- 'marginTop' : '-10px' ,
26
- 'backgroundColor' : backgroundColor ,
27
- 'border' : '1px solid' + borderColor ,
29
+ '&.place-bottom' : {
30
+ 'margin-top' : '10px'
31
+ } ,
32
+ '&.place-bottom:after' : {
33
+ 'border-left' : '8px solid transparent' ,
34
+ 'border-right' : '8px solid transparent' ,
35
+ 'top' : '-6px' ,
36
+ 'left' : '50%' ,
37
+ 'margin-left' : '-8px' ,
38
+ 'border-bottom-color' : arrowColor ,
39
+ 'border-bottom-style' : 'solid' ,
40
+ 'border-bottom-width' : '6px'
41
+ } ,
28
42
29
- '&:before' : {
30
- 'borderLeft' : '10px solid transparent' ,
31
- 'borderRight' : '10px solid transparent' ,
32
- 'bottom' : '-8px' ,
33
- 'left' : '50%' ,
34
- 'marginLeft' : '-10px'
35
- } ,
36
- '&:after' : {
37
- 'borderLeft' : '8px solid transparent' ,
38
- 'borderRight' : '8px solid transparent' ,
39
- 'bottom' : '-6px' ,
40
- 'left' : '50%' ,
41
- 'marginLeft' : '-8px'
42
- } ,
43
+ '&.place-left' : {
44
+ 'margin-left' : '-10px'
45
+ } ,
46
+ '&.place-left:after' : {
47
+ 'border-top' : '5px solid transparent' ,
48
+ 'border-bottom' : '5px solid transparent' ,
49
+ 'right' : '-6px' ,
50
+ 'top' : '50%' ,
51
+ 'margin-top' : '-4px' ,
52
+ 'border-left-color' : arrowColor ,
53
+ 'border-left-style' : 'solid' ,
54
+ 'border-left-width' : '6px'
43
55
} ,
44
56
45
- // TODO: WHERE DOES IT GO??? GOTTA BE SOMEWHERE! - check the existing example: https://react-tooltip.netlify.com/
46
- ':after' : {
47
- 'textAlign' : 'right !important' , // TODO: DEL DEBUG
48
- 'borderTop' : '6px solid violet !important' , //'6px solid ' + backgroundColor, // TODO: REVERT TO SET COLOUR WHEN DONE DEV
49
- 'fontWeight' : 'bold' // TODO: DEL DEBUG
57
+ '&.place-right' : {
58
+ 'margin-left' : '10px'
50
59
} ,
51
- ':before' : {
52
- 'textAlign' : 'right !important' , // TODO: DEL DEBUG
53
- 'borderTop' : '8px solid violet !important' , //'8px solid ' + borderColor, // TODO: REVERT TO SET COLOUR WHEN DONE DEV
54
- 'fontWeight' : 'bold' // TODO: DEL DEBUG
60
+ '&.place-right:after' : {
61
+ 'border-top' : '5px solid transparent' ,
62
+ 'border-bottom' : '5px solid transparent' ,
63
+ 'left' : '-6px' ,
64
+ 'top' : '50%' ,
65
+ 'margin-top' : '-4px' ,
66
+ 'border-right-color' : arrowColor ,
67
+ 'border-right-style' : 'solid' ,
68
+ 'border-right-width' : '6px'
55
69
}
56
-
57
- // '.place-bottom': {
58
- // 'backgroundColor': backgroundColor,
59
- // 'border': '1px solid' + borderColor,
60
- // ':after': {
61
- // 'borderBottom': '6px solid ' + backgroundColor
62
- // },
63
- // ':before': {
64
- // 'borderBottom': '8px solid ' + borderColor
65
- // }
66
- // },
67
- // '.place-left': {
68
- // 'backgroundColor': backgroundColor,
69
- // 'border': '1px solid' + borderColor,
70
- // ':after': {
71
- // 'borderLeft': '6px solid ' + backgroundColor
72
- // },
73
- // ':before': {
74
- // 'borderLeft': '8px solid ' + borderColor
75
- // }
76
- // },
77
- // '.place-right': {
78
- // 'backgroundColor': backgroundColor,
79
- // 'border': '1px solid' + borderColor,
80
- // ':after': {
81
- // 'borderRight': '6px solid ' + backgroundColor
82
- // },
83
- // ':before': {
84
- // 'borderRight': '8px solid ' + borderColor
85
- // }
86
- // }
87
70
}
88
71
89
72
} )
90
- }
73
+ }
0 commit comments