@@ -48,39 +48,48 @@ let Arrow = styled.div`
48
48
`
49
49
50
50
let Tooltip = ( { isOpen, className, children } ) => (
51
- < Transition
52
- items = { isOpen }
53
- from = { { transform : 'translateY(20px)' , opacity : 0 } }
54
- enter = { { transform : 'translateY(0)' , opacity : 1 } }
55
- leave = { { transform : 'translateY(20px)' , opacity : 0 } }
56
- >
57
- { transitionIsOpen =>
58
- transitionIsOpen &&
59
- ( transitionStyle => (
60
- < Popper >
61
- { ( { ref, style, placement, arrowProps } ) => (
62
- < div
63
- ref = { ref }
64
- style = { style }
65
- data-placement = { placement }
66
- className = { className }
67
- >
68
- < Popover style = { transitionStyle } > { children } </ Popover >
51
+ < Popper >
52
+ { ( { ref, style, placement, arrowProps } ) => {
53
+ let translateSign = placement === 'bottom' ? '-' : ''
69
54
70
- < Arrow
71
- { ...arrowProps }
72
- style = { {
73
- ...arrowProps . style ,
74
- opacity : transitionStyle . opacity ,
75
- } }
76
- placement = { placement }
77
- />
78
- </ div >
79
- ) }
80
- </ Popper >
81
- ) )
82
- }
83
- </ Transition >
55
+ return (
56
+ < Transition
57
+ items = { isOpen }
58
+ from = { {
59
+ transform : `translateY(${ translateSign } 30px) scale(0.9)` ,
60
+ opacity : 0 ,
61
+ } }
62
+ enter = { { transform : `translateY(0) scale(1)` , opacity : 1 } }
63
+ leave = { {
64
+ transform : `translateY(${ translateSign } 30px) scale(0.9)` ,
65
+ opacity : 0 ,
66
+ } }
67
+ >
68
+ { transitionIsOpen =>
69
+ transitionIsOpen &&
70
+ ( transitionStyle => (
71
+ < div
72
+ ref = { ref }
73
+ style = { style }
74
+ data-placement = { placement }
75
+ className = { className }
76
+ >
77
+ < Popover style = { transitionStyle } > { children } </ Popover >
78
+
79
+ < Arrow
80
+ { ...{ ...arrowProps , placement } }
81
+ style = { {
82
+ ...arrowProps . style ,
83
+ opacity : transitionStyle . opacity ,
84
+ } }
85
+ />
86
+ </ div >
87
+ ) )
88
+ }
89
+ </ Transition >
90
+ )
91
+ } }
92
+ </ Popper >
84
93
)
85
94
86
95
export default Tooltip
0 commit comments