Update ScrollToTop component and styles

This commit is contained in:
dertyp7
2024-01-13 18:26:16 +01:00
parent d93e8bc250
commit cabbda37f2
2 changed files with 29 additions and 6 deletions

View File

@@ -38,8 +38,8 @@ export default function ScrollToTop() {
<svg <svg
className={`arrow ${isScrolledUp ? "up" : "down"}`} className={`arrow ${isScrolledUp ? "up" : "down"}`}
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width="24" width="32"
height="24" height="32"
viewBox="0 0 24 24" viewBox="0 0 24 24"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"

View File

@@ -1,4 +1,3 @@
// src/styles/ScrollToTop.scss
.scrollToTop { .scrollToTop {
position: fixed; position: fixed;
bottom: 20px; bottom: 20px;
@@ -6,23 +5,35 @@
cursor: pointer; cursor: pointer;
.arrow { .arrow {
transition: transform 200ms ease-in-out; transition: transform 300ms ease-in-out;
&.up { &.up {
transform: rotate(0deg); transform: rotate(0deg);
&:hover {
animation: pulseUp 1s infinite;
}
} }
&.down { &.down {
transform: rotate(-180deg); transform: rotate(-180deg);
width: 50px;
height: 50px;
position: fixed;
bottom: 15px;
right: 50%;
&:hover {
animation: pulseDown 1s infinite;
}
} }
} }
&:hover { &:hover {
animation: pulse 1s infinite;
color: var(--color-accent); color: var(--color-accent);
} }
@keyframes pulse { @keyframes pulseUp {
0% { 0% {
transform: scale(1); transform: scale(1);
} }
@@ -33,4 +44,16 @@
transform: scale(1); transform: scale(1);
} }
} }
@keyframes pulseDown {
0% {
transform: scale(1) rotate(-180deg);
}
50% {
transform: scale(1.4) rotate(-180deg);
}
100% {
transform: scale(1) rotate(-180deg);
}
}
} }