From 147c9fbce19da9e5f4da27dc4b3a502fc7645bab Mon Sep 17 00:00:00 2001 From: thislight Date: Wed, 20 Nov 2024 21:51:29 +0800 Subject: [PATCH] MediaAttachmentGrid: fix layout on WebKit --- src/timelines/MediaAttachmentGrid.css | 19 ++-- src/timelines/MediaAttachmentGrid.tsx | 129 ++++++++++++++------------ 2 files changed, 79 insertions(+), 69 deletions(-) diff --git a/src/timelines/MediaAttachmentGrid.css b/src/timelines/MediaAttachmentGrid.css index a26085c..880151a 100644 --- a/src/timelines/MediaAttachmentGrid.css +++ b/src/timelines/MediaAttachmentGrid.css @@ -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%; - } + object-fit: contain; + } - & > .sensitive-placeholder { - display: flex; - align-items: center; - justify-content: center; - } + >.sensitive-placeholder { + display: inline-flex; + display: inline flex; + align-items: center; + justify-content: center; } } \ No newline at end of file diff --git a/src/timelines/MediaAttachmentGrid.tsx b/src/timelines/MediaAttachmentGrid.tsx index 948bb7b..8fd14e3 100644 --- a/src/timelines/MediaAttachmentGrid.tsx +++ b/src/timelines/MediaAttachmentGrid.tsx @@ -161,65 +161,78 @@ const MediaAttachmentGrid: Component<{ {(item, index) => { const itemType = () => item().type; + + const style = createMemo(() => itemStyle(item())); return ( - + + +
+ + + +
+
+ + {item().description + + + + + + + + +
); }}