api-client/components/app/Shortcuts.vue

122 lines
2.6 KiB
Vue
Raw Normal View History

2020-12-11 10:29:03 +00:00
<template>
2021-07-24 16:46:48 +00:00
<AppSlideOver :show="show" @close="close()">
<template #content>
<div
class="
border-b border-dividerLight
flex
p-2
top-0
z-10
2021-07-24 16:46:48 +00:00
items-center
sticky
justify-between
"
>
2021-08-01 17:33:54 +00:00
<h3 class="ml-4 heading">{{ $t("shortcuts") }}</h3>
2021-08-07 03:37:26 +00:00
<div class="flex">
<ButtonSecondary
icon="close"
class="rounded"
@click.native="close()"
/>
2021-07-24 16:46:48 +00:00
</div>
2020-12-11 10:29:03 +00:00
</div>
2021-08-11 08:46:43 +00:00
<div class="border-b border-dividerLight">
<div class="flex flex-col my-4 mx-6 search-wrapper">
<input
v-model="filterText"
type="search"
class="
bg-primaryLight
border border-dividerLight
rounded
flex
w-full
py-2
pr-2
pl-8
transition
truncate
focus:(border-divider
outline-none)
2021-08-11 08:46:43 +00:00
"
:placeholder="$t('search')"
/>
</div>
</div>
<div
class="
divide-y divide-dividerLight
flex flex-col flex-1
overflow-auto
hide-scrollbar
"
>
2021-07-09 17:19:45 +00:00
<div
v-for="(map, mapIndex) in mappings"
:key="`map-${mapIndex}`"
2021-08-01 17:33:54 +00:00
class="space-y-4 py-4 px-6"
2021-07-09 17:19:45 +00:00
>
<h5 class="font-semibold text-secondaryDark">
{{ map.section }}
</h5>
<div
v-for="(shortcut, shortcutIndex) in map.shortcuts"
:key="`map-${mapIndex}-shortcut-${shortcutIndex}`"
class="flex items-center"
2021-07-09 17:19:45 +00:00
>
2021-08-10 08:16:42 +00:00
<span class="flex flex-1 mr-4">
{{ $t(shortcut.label) }}
</span>
<span
v-for="(key, keyIndex) in shortcut.keys"
:key="`map-${mapIndex}-shortcut-${shortcutIndex}-key-${keyIndex}`"
class="shortcut-key"
>
{{ key }}
</span>
</div>
2020-12-11 16:54:34 +00:00
</div>
2020-12-11 10:29:03 +00:00
</div>
</template>
2021-07-24 16:46:48 +00:00
</AppSlideOver>
2020-12-11 10:29:03 +00:00
</template>
<script>
2021-08-10 08:16:42 +00:00
import shortcuts from "~/helpers/shortcuts"
2020-12-11 10:29:03 +00:00
export default {
props: {
show: Boolean,
},
2021-07-09 17:19:45 +00:00
data() {
return {
2021-07-26 07:10:02 +00:00
filterText: "",
2021-08-10 08:16:42 +00:00
mappings: shortcuts,
2021-07-09 17:19:45 +00:00
}
},
2021-07-24 16:46:48 +00:00
watch: {
$route() {
this.$emit("close")
},
},
2020-12-11 10:29:03 +00:00
methods: {
2021-07-24 16:46:48 +00:00
close() {
this.$emit("close")
2020-12-11 10:29:03 +00:00
},
},
}
</script>
<style lang="scss" scoped>
.shortcut-key {
@apply bg-dividerLight;
@apply rounded;
@apply ml-2;
@apply py-1;
@apply px-2;
@apply inline-flex;
}
</style>