Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions frontend/src/ts/components/ScrollToTop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,37 @@
top: 0;
left: 0;

.button {
pointer-events: all;
.buttons-wrapper {
place-self: end end;
display: flex;
flex-direction: column;
gap: 1rem;
margin-bottom: 2rem;
font-size: 2rem;
width: 4rem;
height: 4rem;
text-align: center;
pointer-events: none;

line-height: 4rem;
background: var(--sub-alt-color);
border-radius: 99rem;
outline: 0.5rem solid var(--bg-color);
.button {
pointer-events: all;
font-size: 2rem;
width: 4rem;
height: 4rem;
text-align: center;

.fas {
line-height: 1;
}
line-height: 4rem;
background: var(--sub-alt-color);
border-radius: 99rem;
outline: 0.5rem solid var(--bg-color);

.fas {
line-height: 1;
}

cursor: pointer;
color: var(--sub-color);
transition: 0.25s;
&:hover {
background: var(--text-color);
color: var(--bg-color);
cursor: pointer;
color: var(--sub-color);
transition: 0.25s;
&:hover {
background: var(--text-color);
color: var(--bg-color);
}
}
}
}
32 changes: 23 additions & 9 deletions frontend/src/ts/components/ScrollToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { JSXElement, createSignal, onMount, onCleanup } from "solid-js";
import { getActivePage } from "../signals/core";
import "./ScrollToTop.scss";

import { navigate } from "../controllers/route-controller";

export function ScrollToTop(): JSXElement {
const [visible, setVisible] = createSignal(false);

Expand All @@ -24,19 +26,31 @@ export function ScrollToTop(): JSXElement {
return (
<div class={`content-grid ScrollToTop`}>
<div
class={`breakout button`}
class={`breakout buttons-wrapper`}
classList={{
invisible: getActivePage() === "test" || !visible(),
}}
onClick={() => {
setVisible(false);
window.scrollTo({
top: 0,
behavior: "smooth",
});
}}
>
<i class="fas fa-angle-double-up"></i>
<div
class="button"
onClick={() => {
void navigate("/");
}}
>
<i class="fas fa-fw fa-keyboard"></i>
</div>
<div
class="button"
onClick={() => {
setVisible(false);
window.scrollTo({
top: 0,
behavior: "smooth",
});
}}
>
<i class="fas fa-angle-double-up"></i>
</div>
</div>
</div>
);
Expand Down
Loading