Skip to content

Commit 7f672d0

Browse files
authored
fix: Fix classNames reassignment when containerClassName is updated (#19)
1 parent a9b22c7 commit 7f672d0

File tree

5 files changed

+1519
-26
lines changed

5 files changed

+1519
-26
lines changed

dev/src/App.svelte

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
closeOnCallback: true,
3333
},
3434
},
35-
containerClassName: useCustomTooltipClass ? 'tooltip' : null,
35+
containerClassName: useCustomTooltipClass ? `tooltip tooltip-${tooltipPosition}` : null,
3636
animated: animateTooltip,
3737
animationEnterClassName: useCustomAnimationEnterClass ? 'tooltip-enter' : null,
3838
animationLeaveClassName: useCustomAnimationLeaveClass ? 'tooltip-leave' : null,
@@ -194,23 +194,36 @@
194194
}
195195
196196
:global(.tooltip::after) {
197-
content: '';
198-
position: absolute;
199-
top: 100%;
200-
left: 50%;
201-
margin-left: -5px;
202-
border-width: 5px;
203-
border-style: solid;
204-
border-color: #ee7008 transparent transparent transparent;
205-
}
206-
207-
:global(.tooltip-enter) {
208-
animation: fadeIn 0.2s linear forwards;
209-
}
210-
211-
:global(.tooltip-leave) {
212-
animation: fadeOut 0.2s linear forwards;
213-
}
197+
content: '';
198+
position: absolute;
199+
margin-left: -5px;
200+
border-width: 5px;
201+
border-style: solid;
202+
}
203+
204+
:global(.tooltip-top::after) {
205+
bottom: -10px;
206+
left: 50%;
207+
border-color: #ee7008 transparent transparent transparent;
208+
}
209+
210+
:global(.tooltip-bottom::after) {
211+
top: -10px;
212+
left: 50%;
213+
border-color: transparent transparent #ee7008 transparent;
214+
}
215+
216+
:global(.tooltip-left::after) {
217+
top: calc(50% - 5px);
218+
right: -10px;
219+
border-color: transparent transparent transparent #ee7008;
220+
}
221+
222+
:global(.tooltip-right::after) {
223+
top: calc(50% - 5px);
224+
left: -5px;
225+
border-color: transparent #ee7008 transparent transparent;
226+
}
214227
215228
@keyframes fadeIn {
216229
from {

public/build/bundle.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)