Merge branch 'dev'

This commit is contained in:
ccbikai
2024-08-08 21:42:25 +08:00
3 changed files with 74 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round">
<polyline points="18 15 12 9 6 15"></polyline>
</svg>

After

Width:  |  Height:  |  Size: 244 B

View File

@@ -2,6 +2,10 @@
-webkit-tap-highlight-color: transparent;
}
html {
scroll-behavior: smooth;
}
.site-title {
view-transition-name: site-title;
transition: 0.2s ease;
@@ -81,3 +85,57 @@
display: block;
}
}
#back-to-top {
display: none;
position: fixed;
bottom: 20px;
right: 20px;
background-color: #fff;
color: var(--secondary-color);
width: 32px;
height: 32px;
border-radius: 100%;
border: none;
font-size: 24px;
text-decoration: none;
opacity: 0;
transition:
opacity 0.3s,
transform 0.3s;
z-index: 1000;
&:hover {
transform: translateY(-3px);
}
&:active {
transform: translateY(1px);
}
img {
filter: var(--icon-secondary-filter);
}
}
/* Use @scroll-timeline to control the display of the button */
@supports (animation-timeline: view()) {
#back-to-top {
display: flex;
align-items: center;
justify-content: center;
animation: fadeIn 0.5s linear both;
animation-timeline: view(block 0 100vh);
}
@keyframes fadeIn {
from {
opacity: 0;
pointer-events: none;
}
to {
opacity: 0.9;
pointer-events: auto;
}
}
}

View File

@@ -42,6 +42,8 @@ const seoParams = {
const HEADER_INJECT = getEnv(import.meta.env, Astro, 'HEADER_INJECT')
const FOOTER_INJECT = getEnv(import.meta.env, Astro, 'FOOTER_INJECT')
const backToTopIcon = 'src/assets/back-to-top.svg'
---
<!doctype html>
@@ -74,6 +76,7 @@ const FOOTER_INJECT = getEnv(import.meta.env, Astro, 'FOOTER_INJECT')
/>
<Fragment set:html={HEADER_INJECT} />
</head>
<body>
<div id="wrapper">
<div id="container">
@@ -123,7 +126,9 @@ const FOOTER_INJECT = getEnv(import.meta.env, Astro, 'FOOTER_INJECT')
</div>
</div>
</div>
<a href="#wrapper" id="back-to-top" aria-label="Back to top">
<img src={backToTopIcon} alt="Back to Top" />
</a>
<Fragment set:html={FOOTER_INJECT} />
</body>
</html>