From 71434e52937f310b285b790fcd6350a18248549b Mon Sep 17 00:00:00 2001 From: thislight Date: Wed, 9 Oct 2024 15:52:14 +0800 Subject: [PATCH] TootBottomSheet: fix title may have multiple lines --- src/timelines/TootBottomSheet.tsx | 34 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/timelines/TootBottomSheet.tsx b/src/timelines/TootBottomSheet.tsx index a6e2694..dc1bc4e 100644 --- a/src/timelines/TootBottomSheet.tsx +++ b/src/timelines/TootBottomSheet.tsx @@ -109,13 +109,11 @@ const TootBottomSheet: Component = (props) => { } }); - const tootTitle = () => { + const tootDisplayName = () => { const t = toot(); if (t) { - const name = resolveCustomEmoji(t.account.displayName, t.account.emojis); - return `${name}'s toot`; + return resolveCustomEmoji(t.account.displayName, t.account.emojis); } - return "Someone's toot"; }; const actSession = () => { @@ -196,6 +194,18 @@ const TootBottomSheet: Component = (props) => { .name :global(img) { max-height: 1em; } + + .name { + display: grid; + grid-template-columns: 1fr auto; + height: calc(var(--title-size) * var(--title-line-height)); + + > :first-child { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } `; return ( @@ -217,11 +227,19 @@ const TootBottomSheet: Component = (props) => { {pushedCount() > 0 ? : } - createRenderEffect(() => (e.innerHTML = tootTitle())) - } - > + use:solid-styled + > + + createRenderEffect( + () => (e.innerHTML = tootDisplayName() ?? "Someone"), + ) + } + > + 's toot + }