mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-10-25 21:43:53 +00:00
Compare commits
4 commits
9a5def4614
...
9cf7c8378c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cf7c8378c | ||
|
|
07cf227dcf | ||
| caef622055 | |||
|
|
697f6fb6d5 |
1 changed files with 169 additions and 14 deletions
|
|
@ -2,16 +2,31 @@
|
||||||
import { getLangFromUrl } from "@/i18n";
|
import { getLangFromUrl } from "@/i18n";
|
||||||
|
|
||||||
const lang = getLangFromUrl(Astro.url);
|
const lang = getLangFromUrl(Astro.url);
|
||||||
const loadingText = lang === "zh" ? "评论区加载中……" : "Loading comments…";
|
const loadingText = lang === "zh" ? "评论区加载中…" : "Loading comments…";
|
||||||
const failedText = lang === "zh" ? "评论区加载失败" : "Failed to load comments";
|
const failedText = lang === "zh" ? "评论区加载失败" : "Failed to load comments";
|
||||||
---
|
---
|
||||||
|
|
||||||
<div id="remark42-status" role="status" aria-atomic="true">
|
<div id="remark42-status" role="status" aria-atomic="true">
|
||||||
<p class="remark42-loading" data-remark42-loading>
|
<p class="remark42-loading" data-remark42-loading>
|
||||||
<span class="status-spinner" aria-hidden="true"></span>
|
<span class="coffee-animation" aria-hidden="true">
|
||||||
|
<span class="coffee">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
<span>{loadingText}</span>
|
<span>{loadingText}</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="remark42-failed" data-remark42-failed hidden>
|
<p class="remark42-failed" data-remark42-failed hidden>
|
||||||
|
<span class="broken-coffee" aria-hidden="true">
|
||||||
|
<span class="coffee-spill"></span>
|
||||||
|
<span class="coffee-fallen">
|
||||||
|
<span class="coffee-half coffee-half-left"></span>
|
||||||
|
<span class="coffee-half coffee-half-right">
|
||||||
|
<span class="coffee-handle"></span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
<span>{failedText}</span>
|
<span>{failedText}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -23,16 +38,17 @@ const failedText = lang === "zh" ? "评论区加载失败" : "Failed to load com
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
min-block-size: 10rem;
|
min-block-size: 10rem;
|
||||||
padding: 2rem 1rem;
|
padding: 1.5rem 1rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.remark42-loading,
|
.remark42-loading,
|
||||||
.remark42-failed {
|
.remark42-failed {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.65rem;
|
gap: 0.85rem;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: var(--status-color);
|
color: var(--status-color);
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
|
|
@ -40,15 +56,151 @@ const failedText = lang === "zh" ? "评论区加载失败" : "Failed to load com
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-spinner {
|
/* Coffee animation adapted from jh3y — jheytompkins.com. */
|
||||||
|
.coffee-animation {
|
||||||
|
position: relative;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: 1rem;
|
width: 2.5rem;
|
||||||
height: 1rem;
|
height: 4rem;
|
||||||
|
color: var(--status-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
justify-items: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1.5px solid color-mix(in srgb, var(--status-accent) 20%, transparent);
|
width: 2rem;
|
||||||
border-top-color: var(--status-accent);
|
height: 2rem;
|
||||||
border-radius: 50%;
|
padding: 0.1rem;
|
||||||
animation: status-spin 1s linear infinite;
|
border-radius: 0.2rem;
|
||||||
|
background: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee::before,
|
||||||
|
.coffee-handle {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 1rem;
|
||||||
|
height: 1.3rem;
|
||||||
|
margin-left: -0.5rem;
|
||||||
|
border: 0.2rem solid currentColor;
|
||||||
|
border-radius: 0.2rem;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee > span {
|
||||||
|
width: 0.4rem;
|
||||||
|
height: 1rem;
|
||||||
|
background: currentColor;
|
||||||
|
opacity: 0.3;
|
||||||
|
animation: coffee-steam 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee > span:nth-child(1) {
|
||||||
|
animation-delay: 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee > span:nth-child(2) {
|
||||||
|
animation-delay: 1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee > span:nth-child(3) {
|
||||||
|
animation-delay: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Two lengthwise halves resting in a spill; reuse the loading cup's silhouette. */
|
||||||
|
.broken-coffee {
|
||||||
|
position: relative;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 4.5rem;
|
||||||
|
height: 4rem;
|
||||||
|
color: var(--status-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-fallen {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.8rem;
|
||||||
|
left: 1.05rem;
|
||||||
|
width: 2rem;
|
||||||
|
height: 2.3rem;
|
||||||
|
transform: rotate(23deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-half {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-half::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
border-radius: 0.2rem;
|
||||||
|
background: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-half-left {
|
||||||
|
transform: translate(-0.16rem, -0.07rem) rotate(-3deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-half-left::before {
|
||||||
|
clip-path: polygon(
|
||||||
|
0 0, 54% 0, 42% 23%, 58% 40%,
|
||||||
|
43% 58%, 56% 76%, 46% 100%, 0 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-half-right {
|
||||||
|
transform: translate(0.17rem, 0.08rem) rotate(3deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-half-right::before {
|
||||||
|
clip-path: polygon(
|
||||||
|
54% 0, 100% 0, 100% 100%, 46% 100%,
|
||||||
|
56% 76%, 43% 58%, 58% 40%, 42% 23%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-spill {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.75rem;
|
||||||
|
left: 0.5rem;
|
||||||
|
width: 3.55rem;
|
||||||
|
height: 2.8rem;
|
||||||
|
border-radius: 43% 57% 30% 70% / 56% 37% 63% 44%;
|
||||||
|
background: currentColor;
|
||||||
|
/* Same ink as the cup, softened like the loading animation's steam. */
|
||||||
|
opacity: 0.2;
|
||||||
|
transform: rotate(-8deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-spill::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: -0.5rem;
|
||||||
|
left: 0.9rem;
|
||||||
|
width: 1.8rem;
|
||||||
|
height: 1.4rem;
|
||||||
|
border-radius: 45% 55% 38% 62%;
|
||||||
|
background: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffee-spill::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 0.45rem;
|
||||||
|
bottom: -0.3rem;
|
||||||
|
width: 2.4rem;
|
||||||
|
height: 1.1rem;
|
||||||
|
border-radius: 40% 60% 54% 46%;
|
||||||
|
background: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#remark42-status[hidden],
|
#remark42-status[hidden],
|
||||||
|
|
@ -61,15 +213,18 @@ const failedText = lang === "zh" ? "评论区加载失败" : "Failed to load com
|
||||||
--status-accent: #9ecbff;
|
--status-accent: #9ecbff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes status-spin {
|
@keyframes coffee-steam {
|
||||||
to {
|
to {
|
||||||
transform: rotate(360deg);
|
opacity: 0;
|
||||||
|
transform: translateY(-200%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.status-spinner {
|
.coffee > span {
|
||||||
animation: none;
|
animation: none;
|
||||||
|
opacity: 0.2;
|
||||||
|
transform: translateY(-65%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue