mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-11 09:06:36 +08:00
fix(account-history): highlight animation is not working on result selection (@byseif21) (#6744)
### Description fix the highlight animation for the account history table (when clicking a chart dot) was not visible or only worked inconsistently. This was because the animation was applied to the <tr> element, but the background color for table rows is set on the <td> elements. As a result, the animation was hidden by the static background color of the table cells. Closes # --------- Co-authored-by: Miodec <jack@monkeytype.com>
This commit is contained in:
parent
dc7c94f6cc
commit
27019d189f
3 changed files with 23 additions and 19 deletions
|
@ -194,8 +194,13 @@
|
|||
table td {
|
||||
-webkit-appearance: unset;
|
||||
}
|
||||
|
||||
table tr {
|
||||
border-radius: var(--roundness);
|
||||
}
|
||||
|
||||
.active {
|
||||
animation: flashHighlight 4s linear 0s 1;
|
||||
animation: accountRowHighlight 4s linear 0s 1;
|
||||
}
|
||||
|
||||
.loadMoreButton {
|
||||
|
@ -315,7 +320,7 @@
|
|||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
tbody tr:nth-child(odd) td {
|
||||
tbody tr:nth-child(odd) {
|
||||
background: var(--sub-alt-color);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,18 +64,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
@keyframes flashHighlight {
|
||||
@keyframes accountRowHighlight {
|
||||
0% {
|
||||
background-color: var(--bg-color) !important;
|
||||
}
|
||||
10% {
|
||||
background-color: var(--main-color) !important;
|
||||
}
|
||||
40% {
|
||||
background-color: var(--main-color) !important;
|
||||
outline: 0.25em solid var(--main-color);
|
||||
}
|
||||
100% {
|
||||
background-color: var(--bg-color) !important;
|
||||
outline: 0.25em solid transparent;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1157,14 +1157,19 @@ $(".pageAccount #accountHistoryChart").on("click", () => {
|
|||
const windowHeight = $(window).height() ?? 0;
|
||||
const offset = $(`#result-${index}`).offset()?.top ?? 0;
|
||||
const scrollTo = offset - windowHeight / 2;
|
||||
$([document.documentElement, document.body]).animate(
|
||||
{
|
||||
scrollTop: scrollTo,
|
||||
},
|
||||
Misc.applyReducedMotion(500)
|
||||
);
|
||||
$(".resultRow").removeClass("active");
|
||||
$(`#result-${index}`).addClass("active");
|
||||
$([document.documentElement, document.body])
|
||||
.stop(true)
|
||||
.animate(
|
||||
{ scrollTop: scrollTo },
|
||||
{
|
||||
duration: Misc.applyReducedMotion(500),
|
||||
done: () => {
|
||||
const element = $(`#result-${index}`);
|
||||
$(".resultRow").removeClass("active");
|
||||
requestAnimationFrame(() => element.addClass("active"));
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(".pageAccount").on("click", ".miniResultChartButton", async (event) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue