mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] render avatar in photoswipe slide, remove repeated alt text (#3985)
* [chore] render avatar in photoswipe slide, remove repeated alt text * bwap bwap
This commit is contained in:
@@ -20,8 +20,20 @@
|
|||||||
.profile .profile-header {
|
.profile .profile-header {
|
||||||
background: $profile-bg;
|
background: $profile-bg;
|
||||||
border-radius: $br;
|
border-radius: $br;
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 1rem;
|
/*
|
||||||
|
Link to open media in slide
|
||||||
|
should fill entire media wrapper.
|
||||||
|
*/
|
||||||
|
a.photoswipe-slide {
|
||||||
|
display: inline-block;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
outline: $button-focus-outline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.moved-to {
|
.moved-to {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
@@ -30,7 +42,9 @@
|
|||||||
|
|
||||||
.header-image-wrapper {
|
.header-image-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 33.33%; /* aspect-ratio 1/3 */
|
aspect-ratio: 3;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -66,6 +80,7 @@
|
|||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
margin-top: calc(-1 * $overlap);
|
margin-top: calc(-1 * $overlap);
|
||||||
gap: 0 1rem;
|
gap: 0 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
|
||||||
.avatar-image-wrapper {
|
.avatar-image-wrapper {
|
||||||
grid-area: avatar;
|
grid-area: avatar;
|
||||||
@@ -82,22 +97,11 @@
|
|||||||
width: $avatar-size;
|
width: $avatar-size;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Link to open media in slide
|
Offset to avoid clashing with
|
||||||
should fill entire media wrapper.
|
thick border around avatars.
|
||||||
*/
|
*/
|
||||||
a.photoswipe-slide {
|
a.photoswipe-slide:focus-visible {
|
||||||
display: inline-block;
|
outline-offset: 0.25rem;
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Offset to avoid clashing with
|
|
||||||
thick border around avatars.
|
|
||||||
*/
|
|
||||||
&:focus-visible {
|
|
||||||
outline: $button-focus-outline;
|
|
||||||
outline-offset: 0.25rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
|
@@ -80,10 +80,7 @@
|
|||||||
|
|
||||||
{{- define "avatar" -}}
|
{{- define "avatar" -}}
|
||||||
{{- with . }}
|
{{- with . }}
|
||||||
<div
|
<div class="photoswipe-gallery odd single avatar-image-wrapper" role="group">
|
||||||
class="photoswipe-gallery odd single avatar-image-wrapper"
|
|
||||||
role="group"
|
|
||||||
>
|
|
||||||
<a
|
<a
|
||||||
class="photoswipe-slide"
|
class="photoswipe-slide"
|
||||||
href="{{- .account.Avatar -}}"
|
href="{{- .account.Avatar -}}"
|
||||||
@@ -91,12 +88,9 @@
|
|||||||
data-pswp-width="{{- template "avatarWidth" . -}}px"
|
data-pswp-width="{{- template "avatarWidth" . -}}px"
|
||||||
data-pswp-height="{{- template "avatarHeight" . -}}px"
|
data-pswp-height="{{- template "avatarHeight" . -}}px"
|
||||||
data-cropped="true"
|
data-cropped="true"
|
||||||
alt="{{- template "avatarAlt" . -}}"
|
|
||||||
title="{{- template "avatarAlt" . -}}"
|
title="{{- template "avatarAlt" . -}}"
|
||||||
>
|
>
|
||||||
<picture
|
<picture>
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
{{- if .account.AvatarAttachment }}
|
{{- if .account.AvatarAttachment }}
|
||||||
<source
|
<source
|
||||||
class="avatar"
|
class="avatar"
|
||||||
@@ -109,7 +103,6 @@
|
|||||||
class="avatar u-photo"
|
class="avatar u-photo"
|
||||||
src="{{- .account.Avatar -}}"
|
src="{{- .account.Avatar -}}"
|
||||||
alt="{{- template "avatarAlt" . -}}"
|
alt="{{- template "avatarAlt" . -}}"
|
||||||
title="{{- template "avatarAlt" . -}}"
|
|
||||||
width="{{- template "avatarWidth" . -}}"
|
width="{{- template "avatarWidth" . -}}"
|
||||||
height="{{- template "avatarHeight" . -}}"
|
height="{{- template "avatarHeight" . -}}"
|
||||||
/>
|
/>
|
||||||
@@ -119,31 +112,60 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "header" -}}
|
||||||
{{- with . }}
|
{{- with . }}
|
||||||
<h2 class="sr-only">Profile for {{ .account.Username -}}</h2>
|
{{- if .account.HeaderAttachment }}
|
||||||
<section class="profile-header" role="region" aria-label="Basic info">
|
<div class="photoswipe-gallery odd single header-image-wrapper" role="group">
|
||||||
{{- if .account.Moved }}
|
<a
|
||||||
{{- include "profileMovedTo" . | indent 2 }}
|
class="photoswipe-slide"
|
||||||
{{- end }}
|
href="{{- .account.Header -}}"
|
||||||
<div class="header-image-wrapper">
|
target="_blank"
|
||||||
|
data-pswp-width="{{- .account.HeaderAttachment.Meta.Original.Width -}}px"
|
||||||
|
data-pswp-height="{{- .account.HeaderAttachment.Meta.Original.Height -}}px"
|
||||||
|
data-cropped="true"
|
||||||
|
title="{{- template "headerAlt" . -}}"
|
||||||
|
>
|
||||||
<picture>
|
<picture>
|
||||||
{{- if .account.HeaderAttachment }}
|
|
||||||
<source
|
<source
|
||||||
srcset="{{- .account.HeaderStatic -}}"
|
srcset="{{- .account.HeaderStatic -}}"
|
||||||
type="{{- .account.HeaderAttachment.PreviewMIMEType -}}"
|
type="{{- .account.HeaderAttachment.PreviewMIMEType -}}"
|
||||||
media="(prefers-reduced-motion: reduce)"
|
media="(prefers-reduced-motion: reduce)"
|
||||||
/>
|
/>
|
||||||
{{- end }}
|
|
||||||
<img
|
<img
|
||||||
src="{{- .account.Header -}}"
|
src="{{- .account.Header -}}"
|
||||||
alt="{{- template "headerAlt" . -}}"
|
alt="{{- template "headerAlt" . -}}"
|
||||||
title="{{- template "headerAlt" . -}}"
|
width="{{- .account.HeaderAttachment.Meta.Original.Width -}}"
|
||||||
|
height="{{- .account.HeaderAttachment.Meta.Original.Height -}}"
|
||||||
/>
|
/>
|
||||||
</picture>
|
</picture>
|
||||||
</div>
|
</a>
|
||||||
|
</div>
|
||||||
|
{{- else }}
|
||||||
|
<div class="header-image-wrapper">
|
||||||
|
<picture>
|
||||||
|
<img
|
||||||
|
src="{{- .account.Header -}}"
|
||||||
|
alt="{{- template "headerAlt" . -}}"
|
||||||
|
title="{{- template "headerAlt" . -}}"
|
||||||
|
/>
|
||||||
|
</picture>
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- with . }}
|
||||||
|
<h2 class="sr-only">Profile for {{ .account.Username -}}</h2>
|
||||||
|
<section class="profile-header" role="region" aria-label="Basic info">
|
||||||
|
{{- if .account.Moved }}
|
||||||
|
{{- include "profileMovedTo" . | indent 1 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with . }}
|
||||||
|
{{- include "header" . | indent 1 }}
|
||||||
|
{{- end }}
|
||||||
<div class="basic-info">
|
<div class="basic-info">
|
||||||
{{- with . }}
|
{{- with . }}
|
||||||
{{- include "avatar" . | indent 3 }}
|
{{- include "avatar" . | indent 2 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<dl class="namerole">
|
<dl class="namerole">
|
||||||
<dt class="sr-only">Display name</dt>
|
<dt class="sr-only">Display name</dt>
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
loading="lazy"
|
loading="lazy"
|
||||||
{{- if .Description }}
|
{{- if .Description }}
|
||||||
alt="{{- .Description -}}"
|
alt="{{- .Description -}}"
|
||||||
title="{{- .Description -}}"
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
width="{{- .Meta.Small.Width -}}"
|
width="{{- .Meta.Small.Width -}}"
|
||||||
height="{{- .Meta.Small.Height -}}"
|
height="{{- .Meta.Small.Height -}}"
|
||||||
@@ -37,7 +36,6 @@
|
|||||||
loading="lazy"
|
loading="lazy"
|
||||||
{{- if .Description }}
|
{{- if .Description }}
|
||||||
alt="{{- .Description -}}"
|
alt="{{- .Description -}}"
|
||||||
title="{{- .Description -}}"
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
width="518"
|
width="518"
|
||||||
height="460"
|
height="460"
|
||||||
@@ -138,7 +136,6 @@
|
|||||||
data-pswp-height="{{- .Item.Meta.Original.Height -}}px"
|
data-pswp-height="{{- .Item.Meta.Original.Height -}}px"
|
||||||
data-cropped="true"
|
data-cropped="true"
|
||||||
{{- if .Item.Description }}
|
{{- if .Item.Description }}
|
||||||
alt="{{- .Item.Description -}}"
|
|
||||||
title="{{- .Item.Description -}}"
|
title="{{- .Item.Description -}}"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user