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;
@ -23,11 +38,11 @@
gap: 16px; gap: 16px;
align-items: center; align-items: center;
& > :nth-child(2) { &> :nth-child(2) {
flex-grow: 1; flex-grow: 1;
} }
& > :last-child { &> :last-child {
flex-grow: 1; flex-grow: 1;
text-align: right; text-align: right;
} }
@ -51,14 +66,14 @@
table.acct-fields { table.acct-fields {
word-break: break-all; word-break: break-all;
& td > a { & td>a {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
color: inherit; color: inherit;
min-height: 44px; min-height: 44px;
} }
& a > .invisible { & a>.invisible {
display: none; display: none;
} }

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) => {