Skip to content

Commit 6814f36

Browse files
added tooltip directions
1 parent adecb02 commit 6814f36

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

src/Components/Tooltip/Tooltip.scss

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
.#{$tooltip-name} {
99
display: inline-flex;
1010
justify-content: center;
11+
align-items: center;
1112
position: relative;
1213
cursor: default;
1314
.#{$tooltip-text} {
1415
position: absolute;
16+
display: flex;
17+
align-items: center;
18+
justify-content: center;
1519
color: theme('color-negative');
1620
font-size: .9em;
1721
font-weight: 600;
18-
text-align: center;
1922
visibility: hidden;
2023
background-color: theme('color-dark');
2124
border-radius: theme('border-radius');
@@ -38,6 +41,47 @@
3841
border-color: transparent transparent theme('color-dark') transparent;
3942
}
4043
}
44+
&.#{$tooltip-left},
45+
&.#{$tooltip-right} {
46+
&>.#{$tooltip-text} {
47+
top: auto;
48+
&::after {
49+
bottom: auto;
50+
}
51+
}
52+
}
53+
&.#{$tooltip-right} {
54+
&>.#{$tooltip-text} {
55+
left: 110%;
56+
&::after {
57+
right: 100%;
58+
left: auto;
59+
border-color: transparent theme('color-dark') transparent transparent;
60+
}
61+
}
62+
}
63+
&.#{$tooltip-left} {
64+
&>.#{$tooltip-text} {
65+
right: 110%;
66+
&::after {
67+
left: 100%;
68+
right: auto;
69+
margin: auto -5px auto auto ;
70+
border-color: transparent transparent transparent theme('color-dark');
71+
}
72+
}
73+
}
74+
&.#{$tooltip-top} {
75+
&>.#{$tooltip-text} {
76+
top: auto;
77+
bottom: 120%;
78+
&::after {
79+
bottom: auto;
80+
top: 100%;
81+
border-color: theme('color-dark') transparent transparent transparent;
82+
}
83+
}
84+
}
4185
&:hover .#{$tooltip-text} {
4286
visibility: visible;
4387
opacity: 1;

src/Components/Tooltip/variables.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
/// CLASS NAMING ========================================
66
$tooltip-name: 'tooltip';
7-
$tooltip-text: 'text';
7+
$tooltip-text: 'text';
8+
// directions
9+
$tooltip-right: 'right';
10+
$tooltip-left: 'left';
11+
$tooltip-top: 'top';

0 commit comments

Comments
 (0)