mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: enhance tooltip functionality; prevent empty tooltips for paste titles
This commit is contained in:
@@ -37,6 +37,7 @@ export function dateToRelativeString(date: Date, useSuffix = true): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function tooltip(node: HTMLElement, text: string) {
|
export function tooltip(node: HTMLElement, text: string) {
|
||||||
|
if (!text || text.trim() === '') return;
|
||||||
let tooltipEl: HTMLDivElement | null;
|
let tooltipEl: HTMLDivElement | null;
|
||||||
let caretEl: HTMLDivElement | null;
|
let caretEl: HTMLDivElement | null;
|
||||||
let showTimeout: ReturnType<typeof setTimeout>;
|
let showTimeout: ReturnType<typeof setTimeout>;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
<h1
|
<h1
|
||||||
use:tooltip={data.paste.title || 'Untitled Paste'}
|
use:tooltip={data.paste.title || 'Untitled Paste'}
|
||||||
class="mb-4 truncate text-center text-4xl font-bold"
|
class="mb-4 truncate text-center text-4xl font-bold"
|
||||||
|
use:tooltip={data.paste.title && data.paste.title.length > 40 ? data.paste.title : ''}
|
||||||
>
|
>
|
||||||
{data.paste.title || 'Untitled Paste'}
|
{data.paste.title || 'Untitled Paste'}
|
||||||
</h1>
|
</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user