Profile: hide alt text if the image is not loaded

This commit is contained in:
thislight 2024-11-06 18:39:38 +08:00
parent e2a1f38958
commit 4aac0381ae
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
2 changed files with 21 additions and 13 deletions

View file

@ -8,6 +8,21 @@
gap: 16px; gap: 16px;
} }
.banner {
width: 100%;
margin-top: calc(-1 * (var(--scaffold-topbar-height) + var(--safe-area-inset-top)));
>img {
object-fit: cover;
width: 100%;
height: 100%;
&::before {
visibility: hidden;
}
}
}
.description { .description {
& a { & a {
color: inherit; color: inherit;

View file

@ -336,21 +336,14 @@ const Profile: Component = () => {
</Menu> </Menu>
<div <div
style={{ style={{
width: "100%",
height: `${268 * (Math.min(560, windowSize.width) / 560)}px`, height: `${268 * (Math.min(560, windowSize.width) / 560)}px`,
"margin-top":
"calc(-1 * (var(--scaffold-topbar-height) + var(--safe-area-inset-top)))",
}} }}
class="banner"
role="presentation" role="presentation"
> >
<img <img
ref={(e) => obx.observe(e)} ref={(e) => obx.observe(e)}
src={bannerImg()} src={bannerImg()}
style={{
"object-fit": "cover",
width: "100%",
height: "100%",
}}
crossOrigin="anonymous" crossOrigin="anonymous"
alt={`Banner image for ${profile()?.displayName || "the user"}`} alt={`Banner image for ${profile()?.displayName || "the user"}`}
onLoad={(event) => { onLoad={(event) => {