Socialify

Folder ..

Viewing _pm-tooltips.scss
83 lines (77 loc) • 2.0 KB

 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
/*
 * tooltips
 */
 $tooltip-width: 14em;
 $arrow-width: .5em;
 
 [class*="tooltip-"][aria-hidden="true"]:not(.tooltip-container) {
   display: none;
 }
 
 /* position relative for containers */
 .tooltip-container {
   @extend .relative;
   @extend .inbl;
 }
 
 /* tooltip styles */
 /* factorisation */
 [class*="tooltip-"]:not(.tooltip-container) {
   position: absolute;
   z-index: 666;
   width: $tooltip-width;
   border-radius: $global-border-radius;
   background: $pm-global-grey;
   color: $pm-global-light;
   padding: .5em;
   text-align: center;
 }
 .tooltip-top {
   bottom: calc(100% + #{$arrow-width} + 10px ); // 100% from bottom + arrow width + small margin
   left: calc(50% - #{$tooltip-width/2} );
 }
 .tooltip-right {
   left: calc(100% + #{$arrow-width} + 10px );
   top: 0;
 }
 .tooltip-bottom {
   top: calc(100% + #{$arrow-width} + 10px ); // 100% from bottom + arrow width + small margin
   left: calc(50% - #{$tooltip-width/2} );
 }
 .tooltip-left {
   right: calc(100% + #{$arrow-width} + 10px );
   top: 0;
 }
 
 /* used pseudo-element to make arrows */
 /* factorisation */
 [class*="tooltip-"]:not(.tooltip-container)::before {
   content: '';
   speak: none;
   position: absolute;
   z-index: 666;
   width: $arrow-width;
   height: $arrow-width;
   pointer-events: none;
 }
 
 .tooltip-top::before {
   top: 100%;
   left: calc(50% - #{$arrow-width} );
   border: $arrow-width solid transparent;
   border-top: $arrow-width solid $pm-global-grey;
 }
 .tooltip-right::before {
   top: calc(50% - #{$arrow-width} );
   left: -#{$arrow-width*2};
   border: $arrow-width solid transparent;
   border-right: $arrow-width solid $pm-global-grey;
 }
 .tooltip-bottom::before {
   bottom: 100%;
   left: calc(50% - #{$arrow-width} );
   border: $arrow-width solid transparent;
   border-bottom: $arrow-width solid $pm-global-grey;
 }
 .tooltip-left::before {
   top: calc(50% - #{$arrow-width} );
   right: -#{$arrow-width*2};
   border: $arrow-width solid transparent;
   border-left: $arrow-width solid $pm-global-grey;
 }
 
 
 /* responsive ? */