diff --git a/src/lib/components/Dialog.svelte b/src/lib/components/Dialog.svelte index e305eee..a4ec2a3 100644 --- a/src/lib/components/Dialog.svelte +++ b/src/lib/components/Dialog.svelte @@ -40,16 +40,18 @@ class="dialog" >
-
- -
{title}
-
+ {#if title.length || description.length} +
+ +
{title}
+
+ {/if}
{#if description} @@ -113,8 +115,11 @@ .title { --padding: 1rem; + --background-color: #ffffff; + --text-color: black; position: relative; - background-color: #ffffff; + background-color: var(--background-color); + color: var(--text-color); background-clip: padding-box; border-radius: 12px; display: flex; diff --git a/src/lib/components/GlobalSearch.svelte b/src/lib/components/GlobalSearch.svelte index ccc8605..7ef80cc 100644 --- a/src/lib/components/GlobalSearch.svelte +++ b/src/lib/components/GlobalSearch.svelte @@ -35,6 +35,14 @@ }, 50); }; + function openElement(link: string) { + if (String(link)?.startsWith('/')) { + goto(link); + } else { + window.open(link, '_blank'); + } + } + function registerShortcutKey() { document.addEventListener('keydown', function (event) { // listen for open/close command + k @@ -81,11 +89,7 @@ const { link } = filteredchildren[focusIndex]; toggleSearchDialog(); - if (String(link)?.startsWith('/')) { - goto(link); - } else { - window.open(link, '_blank'); - } + openElement(link); } }); } @@ -96,16 +100,22 @@ {#if open} - (open = false)} title="Search on page" description=""> + (open = false)} title="" description="">
- +
    {#each filteredchildren as element, index (element)} -
  • -

    {element?.name}

    +
  • openElement(element?.link) ?? '/'} + > +
    +

    {element?.name}

    + {element?.link} +
    -
    +
    {#each Object.entries(element) as [key, value] (key)} {key}: {value} {/each} @@ -113,11 +123,31 @@
  • {/each}
+ +
+ Press Esc to close · + + K to toggle +
{/if}