mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-05 18:48:41 +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) {
|
||||
if (!text || text.trim() === '') return;
|
||||
let tooltipEl: HTMLDivElement | null;
|
||||
let caretEl: HTMLDivElement | null;
|
||||
let showTimeout: ReturnType<typeof setTimeout>;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<h1
|
||||
use:tooltip={data.paste.title || 'Untitled Paste'}
|
||||
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'}
|
||||
</h1>
|
||||
|
||||
Reference in New Issue
Block a user