diff --git a/frontend/public/global.css b/frontend/public/global.css index 6a3549e..105dd3e 100644 --- a/frontend/public/global.css +++ b/frontend/public/global.css @@ -21,6 +21,25 @@ a { a:hover { text-decoration: underline; } +::-webkit-scrollbar { + width: 12px; + overflow-y: hidden; +} +::-webkit-scrollbar-track { + background-color: transparent; +} +::-webkit-scrollbar-thumb { + background-color: #d6dee1; + /* background-color: transparent; */ + border-radius: 20px; + border: 4px solid transparent; + background-clip: content-box; +} +::-webkit-scrollbar-thumb:hover { + background-color: #a8bbbf; + border: 2px solid transparent; + background-clip: content-box; +} a:visited { color: rgb(0,80,160); diff --git a/frontend/src/assets/Chat.svelte b/frontend/src/assets/Chat.svelte index 11554a9..a402c17 100644 --- a/frontend/src/assets/Chat.svelte +++ b/frontend/src/assets/Chat.svelte @@ -1,5 +1,6 @@
- +
+
    + {#each $chatMessages as message} +
  • + + {message.author}: + {message.message} +
  • + {/each} +
    +
+
{ searchResults = []; // #42 searchResults = await provider.search(searchQuery, true); @@ -42,7 +47,6 @@ let timer; const debounce = (e: KeyboardEvent) => { - if (e.key === "Enter") { return; } @@ -52,6 +56,15 @@ await fetchFirstGifs(); }, 300); }; + + const previewGif = (e: MouseEvent, gif?: SearchResult) => { + gifPreviewURL = gif?.original_url ?? ""; + + if (gifPreviewWindow) { + gifPreviewWindow.style.left = e.pageX + "px"; + gifPreviewWindow.style.top = e.pageY + "px"; + } + }; @@ -70,7 +83,7 @@ type="text" class="gyf-bar" placeholder="Search via {provider.name} 🔍" - on:keyup="{debounce}" + on:keyup={debounce} bind:value={searchQuery} /> @@ -83,11 +96,24 @@ /> {/if}
-
+ {#if gifPreviewURL} + GYF preview (blur = false)} + /> + {/if} + +
previewGif(e, undefined)}> {#if searchResults.length > 0} {#each searchResults as result}
previewGif(e, result)} + on:mouseleave={(_) => (blur = true)} on:click={(e) => submitGif(e, result)} >