Browse Source

Merge pull request 'Escape key closes TaskPanel' (#15) from exyi/esc-close into master

Reviewed-on: https://gitea.ks.matfyz.cz/KSP/graf-uloh/pulls/15
mj-deploy
Vašek Šraier 4 years ago
parent
commit
064aff00fa
  1. 8
      frontend/src/TaskPanel.svelte

8
frontend/src/TaskPanel.svelte

@ -37,6 +37,12 @@ import TaskDisplay from "./TaskDisplay.svelte";
behavior: 'smooth'
}), 100)
}
function handleKeydown(e: KeyboardEvent) {
if (e.key === "Escape") {
close()
}
}
</script>
<style>
@ -80,6 +86,8 @@ import TaskDisplay from "./TaskDisplay.svelte";
.panel.full .closeButton { display: inherit }
</style>
<svelte:window on:keydown={handleKeydown} />
<div class="panel {heightClass}"
on:click={() => selectedTask && select(selectedTask)}>
<TaskDisplay taskId={selectedTask?.id} />