Skip to content

Commit

Permalink
feat: add mobile fuzzy finder (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
kocierik authored Sep 17, 2023
1 parent 04d3eef commit e582904
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/routes/[...dir]/[zfile=dir]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
} else if (e.key === 'k' && e.ctrlKey) {
e.preventDefault();
if (!searchActive) searchActive = true;
setTimeout(() => {
searchInput.focus();
}, 100);
} else if (e.key === 'ArrowDown' && resultList) {
e.preventDefault();
active = active < resultList.children.length - 1 ? active + 1 : active;
Expand All @@ -79,6 +79,13 @@
}
}
}
function viewMobileFinder() {
searchActive = !searchActive;
setTimeout(() => {
searchInput.focus();
}, 100);
}
</script>

<svelte:head>
Expand All @@ -87,20 +94,25 @@

<svelte:body on:keydown={keydown} />

<main class="max-w-5xl p-4 mx-auto">
<main class="max-w-6xl p-4 mx-auto">
<div class="navbar flex bg-base-200 text-neutral-content rounded-box shadow-sm px-5 mb-5">
<div class="navbar-center">
<div class="text-xs breadcrumbs sm:text-sm">
<div class="lg:text-lg breadcrumbs text-sm">
<ul>
<li>🏠<a href="/">Dynamik</a></li>
<li>🏠<a class="ml-1" href="/">Dynamik</a></li>
{#each urlParts as part}
{@const href = getPartHref(part)}
<li><a {href}>{part}</a></li>
{/each}
</ul>
</div>

</div>
<div class="flex flex-1 justify-end mr-2" >
<button class="lg:ml-2 p-1 bg-base-300 rounded-lg btn-ghost" title="ctrl + k" on:click|preventDefault={() => viewMobileFinder()}>
🔍 <kbd class="kbd-sm hidden lg:inline-block">ctrl + k </kbd>
</button>
</div>
<div class="navbar-end" />
</div>

<div class="grid gap-5 grid-cols-dir md:grid-cols-dir-full mx-4 text-lg">
Expand Down Expand Up @@ -147,3 +159,4 @@
{/if}
</label>
</label>

1 comment on commit e582904

@vercel
Copy link

@vercel vercel bot commented on e582904 Sep 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dynamik – ./

dynamik-git-main-csunibo.vercel.app
dynamik.vercel.app
dynamik-csunibo.vercel.app

Please sign in to comment.