MediaAttachmentGrid: fix layout on WebKit
All checks were successful
/ depoly (push) Successful in 1m22s
All checks were successful
/ depoly (push) Successful in 1m22s
This commit is contained in:
parent
8d8d2a8fb1
commit
147c9fbce1
2 changed files with 79 additions and 69 deletions
|
@ -6,7 +6,7 @@
|
|||
gap: 4px;
|
||||
contain: layout style;
|
||||
|
||||
>.cell {
|
||||
> :where(img, video, .sensitive-placeholder) {
|
||||
max-height: 35vh;
|
||||
min-height: 40px;
|
||||
min-width: 40px;
|
||||
|
@ -24,16 +24,13 @@
|
|||
border-color: var(--media-color-accent, var(--tutu-color-surface-d));
|
||||
}
|
||||
|
||||
& > :where(img, video, .sensitive-placeholder) {
|
||||
object-fit: contain;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
& > .sensitive-placeholder {
|
||||
display: flex;
|
||||
>.sensitive-placeholder {
|
||||
display: inline-flex;
|
||||
display: inline flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -161,17 +161,17 @@ const MediaAttachmentGrid: Component<{
|
|||
<Index each={props.attachments}>
|
||||
{(item, index) => {
|
||||
const itemType = () => item().type;
|
||||
|
||||
const style = createMemo(() => itemStyle(item()));
|
||||
return (
|
||||
<Switch>
|
||||
<Match when={props.sensitive && !isReveal(index)}>
|
||||
<div
|
||||
class="cell"
|
||||
role="presentation"
|
||||
style={itemStyle(item())}
|
||||
class="sensitive-placeholder"
|
||||
style={style()}
|
||||
data-sort={index}
|
||||
data-media-type={item().type}
|
||||
>
|
||||
<Switch>
|
||||
<Match when={props.sensitive && !isReveal(index)}>
|
||||
<div class="sensitive-placeholder">
|
||||
<IconButton
|
||||
color="inherit"
|
||||
size="large"
|
||||
|
@ -190,6 +190,9 @@ const MediaAttachmentGrid: Component<{
|
|||
alt={item().description || undefined}
|
||||
onClick={[openViewerFor, index]}
|
||||
loading="lazy"
|
||||
style={style()}
|
||||
data-sort={index}
|
||||
data-media-type={item().type}
|
||||
></img>
|
||||
</Match>
|
||||
<Match when={itemType() === "video"}>
|
||||
|
@ -201,6 +204,9 @@ const MediaAttachmentGrid: Component<{
|
|||
poster={item().previewUrl}
|
||||
width={item().meta?.small?.width}
|
||||
height={item().meta?.small?.height}
|
||||
style={style()}
|
||||
data-sort={index}
|
||||
data-media-type={item().type}
|
||||
/>
|
||||
</Match>
|
||||
<Match when={itemType() === "gifv"}>
|
||||
|
@ -213,13 +219,20 @@ const MediaAttachmentGrid: Component<{
|
|||
poster={item().previewUrl}
|
||||
width={item().meta?.small?.width}
|
||||
height={item().meta?.small?.height}
|
||||
style={style()}
|
||||
data-sort={index}
|
||||
data-media-type={item().type}
|
||||
/>
|
||||
</Match>
|
||||
<Match when={itemType() === "audio"}>
|
||||
<audio src={item().url || undefined} controls></audio>
|
||||
<audio
|
||||
src={item().url || undefined}
|
||||
controls
|
||||
data-sort={index}
|
||||
data-media-type={item().type}
|
||||
></audio>
|
||||
</Match>
|
||||
</Switch>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Index>
|
||||
|
|
Loading…
Reference in a new issue