Skip to content

Commit 51666ea

Browse files
authored
Tooltip visual refresh (#2532)
* match react tooltip * lint * lint * Create ten-poets-yawn.md * remove delay
1 parent 2070709 commit 51666ea

File tree

2 files changed

+12
-60
lines changed

2 files changed

+12
-60
lines changed

.changeset/ten-poets-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": minor
3+
---
4+
5+
Tooltip visual refresh

src/tooltips/tooltips.scss

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* stylelint-disable primer/spacing */
2+
13
.tooltipped {
24
position: relative;
35
}
@@ -7,8 +9,8 @@
79
position: absolute;
810
z-index: 1000000;
911
display: none;
10-
padding: $em-spacer-5 $em-spacer-6;
11-
font: normal normal 11px/1.5 $body-font;
12+
padding: var(--overlay-paddingBlock-condensed, 0.25rem) var(--overlay-padding-condensed, 0.5rem);
13+
font: var(--text-body-shorthand-small, normal normal 11px/1.5 $body-font);
1214
-webkit-font-smoothing: subpixel-antialiased;
1315
color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis));
1416
text-align: center;
@@ -21,22 +23,8 @@
2123
pointer-events: none;
2224
content: attr(aria-label);
2325
background: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
24-
border-radius: $border-radius;
25-
opacity: 0;
26-
}
27-
28-
// This is the tooltip arrow
29-
.tooltipped::before {
30-
position: absolute;
31-
z-index: 1000001;
32-
display: none;
33-
width: 0;
34-
height: 0;
35-
color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
36-
pointer-events: none;
37-
content: '';
3826
// stylelint-disable-next-line primer/borders
39-
border: 6px $border-style transparent;
27+
border-radius: var(--borderRadius-medium);
4028
opacity: 0;
4129
}
4230

@@ -63,7 +51,6 @@
6351
animation-duration: $tooltip-duration;
6452
animation-fill-mode: forwards;
6553
animation-timing-function: ease-in;
66-
animation-delay: $tooltip-delay;
6754
}
6855
}
6956

@@ -91,18 +78,8 @@
9178
&::after {
9279
top: 100%;
9380
right: 50%;
94-
// stylelint-disable-next-line primer/spacing
9581
margin-top: 6px;
9682
}
97-
98-
&::before {
99-
top: auto;
100-
right: 50%;
101-
bottom: -7px;
102-
// stylelint-disable-next-line primer/spacing
103-
margin-right: -6px;
104-
border-bottom-color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
105-
}
10683
}
10784

10885
.tooltipped-se {
@@ -124,18 +101,8 @@
124101
&::after {
125102
right: 50%;
126103
bottom: 100%;
127-
// stylelint-disable-next-line primer/spacing
128104
margin-bottom: 6px;
129105
}
130-
131-
&::before {
132-
top: -7px;
133-
right: 50%;
134-
bottom: auto;
135-
// stylelint-disable-next-line primer/spacing
136-
margin-right: -6px;
137-
border-top-color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
138-
}
139106
}
140107

141108
.tooltipped-ne {
@@ -161,39 +128,19 @@
161128
&::after {
162129
right: 100%;
163130
bottom: 50%;
164-
// stylelint-disable-next-line primer/spacing
165131
margin-right: 6px;
166132
transform: translateY(50%);
167133
}
168-
169-
&::before {
170-
top: 50%;
171-
bottom: 50%;
172-
left: -7px;
173-
// stylelint-disable-next-line primer/spacing
174-
margin-top: -6px;
175-
border-left-color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
176-
}
177134
}
178135

179136
// tooltipped to the right
180137
.tooltipped-e {
181138
&::after {
182139
bottom: 50%;
183140
left: 100%;
184-
// stylelint-disable-next-line primer/spacing
185141
margin-left: 6px;
186142
transform: translateY(50%);
187143
}
188-
189-
&::before {
190-
top: 50%;
191-
right: -7px;
192-
bottom: 50%;
193-
// stylelint-disable-next-line primer/spacing
194-
margin-top: -6px;
195-
border-right-color: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
196-
}
197144
}
198145

199146
// Tooltip align right and left
@@ -218,7 +165,7 @@
218165
}
219166

220167
.tooltipped-align-left-1,
221-
.tooltipped-align-left-2, {
168+
.tooltipped-align-left-2 {
222169
&::after {
223170
left: 0;
224171
margin-left: 0;
@@ -245,7 +192,7 @@
245192
.tooltipped-multiline {
246193
&::after {
247194
width: max-content;
248-
max-width: $tooltip-max-width;
195+
max-width: var(--overlay-width-small, 20rem);
249196
word-wrap: break-word;
250197
white-space: pre-line;
251198
border-collapse: separate;

0 commit comments

Comments
 (0)