Skip to content

Commit 6a386ef

Browse files
committed
🐛 Fix tooltip and timeline alignment issues
1 parent 39f9bf8 commit 6a386ef

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

src/components/Timeline/timeline.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ body {
2828
left: $leftOffset
2929
}
3030

31-
&.fill li::before {
31+
&.fill > li::before {
3232
content: '';
3333
}
3434

35-
&.stroke li::before {
35+
&.stroke > li::before {
3636
@include background(primary-70);
3737
border: 2px solid var(--w-timeline-color);
3838
}
@@ -47,7 +47,7 @@ body {
4747
left: calc(50% - 1px);
4848
}
4949

50-
li {
50+
> li {
5151
@include size('w50%');
5252

5353
&:nth-child(odd) {
@@ -69,7 +69,7 @@ body {
6969
}
7070
}
7171

72-
&.centered li:nth-child(odd) {
72+
&.centered > li:nth-child(odd) {
7373
@include typography(right);
7474
}
7575
}

src/pages/tooltip.astro

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const tooltipStyle = [
1414
<h1>Tooltip</h1>
1515
<div class="grid md-2 lg-3">
1616
<ComponentWrapper title="Default">
17-
<p data-tooltip="Tooltip content">Default tooltip</p>
17+
<span data-tooltip="Tooltip content">Default tooltip</span>
1818
</ComponentWrapper>
1919

2020
<ComponentWrapper title="Custom color">
21-
<p data-tooltip="Tooltip content" style={tooltipStyle}>
21+
<span data-tooltip="Tooltip content" style={tooltipStyle}>
2222
Colored tooltip
23-
</p>
23+
</span>
2424
</ComponentWrapper>
2525

2626
<ComponentWrapper title="Tooltip on button">
@@ -30,21 +30,21 @@ const tooltipStyle = [
3030
</ComponentWrapper>
3131

3232
<ComponentWrapper title="Bottom position">
33-
<p data-tooltip="Tooltip content" data-position="bottom">
33+
<span data-tooltip="Tooltip content" data-position="bottom">
3434
Bottom tooltip
35-
</p>
35+
</span>
3636
</ComponentWrapper>
3737

3838
<ComponentWrapper title="Left position">
39-
<p data-tooltip="Tooltip content" data-position="left">
39+
<span data-tooltip="Tooltip content" data-position="left">
4040
Left tooltip
41-
</p>
41+
</span>
4242
</ComponentWrapper>
4343

4444
<ComponentWrapper title="Right position">
45-
<p data-tooltip="Tooltip content" data-position="right">
45+
<span data-tooltip="Tooltip content" data-position="right">
4646
Right tooltip
47-
</p>
47+
</span>
4848
</ComponentWrapper>
4949
</div>
5050
</Layout>

src/scss/global/tooltip.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
[data-tooltip] {
1010
@include position(relative);
11+
@include typography(normal);
12+
1113
display: inline-block;
1214

1315
&::before,
@@ -94,7 +96,7 @@
9496
@include border(5px, top, transparent);
9597
@include border(5px, bottom, transparent);
9698

97-
top: calc(50% - 2.5px);
99+
top: calc(50%);
98100
border-left: 5px solid var(--w-tooltip-background);
99101
transform: translate(10px, -50%);
100102
}
@@ -123,7 +125,7 @@
123125
@include border(5px, top, transparent);
124126
@include border(5px, bottom, transparent);
125127

126-
top: calc(50% - 2.5px);
128+
top: calc(50%);
127129
border-right: 5px solid var(--w-tooltip-background);
128130
transform: translate(-10px, -50%);
129131
}

0 commit comments

Comments
 (0)