Skip to content

Commit

Permalink
feat: scroll when trying to filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Nov 11, 2024
1 parent d5d1575 commit a336eed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/components/Viewer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ import Alpine from "@components/Alpine.astro";
if (input.query_file.length < 3) {
return;
}
// scroll to top on file search with id files
document.getElementById("files").scroll(0,0)



const minMatchLength = 3; // Minimum length of matching substring
const matching_file_paths = results.file_paths_backup.filter((curr) => {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/partials/viewer/Inputs.astro
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
<input
type="text"
x-model="input.query_file"
@click="document.getElementById('files').scroll(0,0)"
@keyup="submitFile"
class="w-1/5 p-2 font-mono ps-10 text-sm bg-gray-900 border-b border-b-gray-700 placeholder-gray-400 text-white focus:outline-none"
placeholder="Filter file"
Expand All @@ -189,6 +190,7 @@
<template x-for="type in ['file', 'ssh', 'stdin', 'docker']">
<ul
class="max-h-48 xl:ml-10 px-3 pt-2 pb-2 overflow-y-auto text-sm text-gray-200 no-scrollbar break-all"
id="files"
>
<template
x-if="results.file_paths.filter((fp) => fp.type == type).length"
Expand Down

0 comments on commit a336eed

Please sign in to comment.