Last active
August 4, 2020 23:02
-
-
Save skflowne/75b20927869723bacc639700a2251f63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { onMount } from "svelte" | |
import Tailwind from "./Tailwind.svelte" | |
import FileList from "./components/file-search/FileList.svelte" | |
import FileSearch from "./components/file-search/FileSearch.svelte" | |
import files from "./store/files" | |
let searching = false | |
const handleKeyUp = (e: KeyboardEvent) => { | |
if (e.key === "t" || e.key === "T") { | |
searching = true | |
} | |
if (e.key === "Escape") { | |
searching = false | |
} | |
} | |
onMount(() => { | |
document.addEventListener("keyup", handleKeyUp) | |
return () => { | |
document.removeEventListener("keyup", handleKeyUp) | |
} | |
}) | |
</script> | |
<Tailwind /> | |
<main> | |
{#if searching} | |
<FileSearch /> | |
{/if} | |
<FileList files={$files} /> | |
</main> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment