feat: placement option (center, top) in modals
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<SmartModal v-if="show" @close="$emit('hide-modal')">
|
<SmartModal v-if="show" placement="top" @close="$emit('hide-modal')">
|
||||||
<template #body>
|
<template #body>
|
||||||
<input
|
<input
|
||||||
id="command"
|
id="command"
|
||||||
|
v-model="search"
|
||||||
v-focus
|
v-focus
|
||||||
type="text"
|
type="text"
|
||||||
name="command"
|
name="command"
|
||||||
@@ -30,7 +31,10 @@
|
|||||||
hide-scrollbar
|
hide-scrollbar
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div v-for="(map, mapIndex) in mappings" :key="`map-${mapIndex}`">
|
<div
|
||||||
|
v-for="(map, mapIndex) in filteredMappings"
|
||||||
|
:key="`map-${mapIndex}`"
|
||||||
|
>
|
||||||
<h5 class="font-normal my-2 text-secondaryLight py-2 px-4">
|
<h5 class="font-normal my-2 text-secondaryLight py-2 px-4">
|
||||||
{{ map.section }}
|
{{ map.section }}
|
||||||
</h5>
|
</h5>
|
||||||
@@ -83,9 +87,21 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
search: "",
|
||||||
mappings: spotlight,
|
mappings: spotlight,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
filteredMappings() {
|
||||||
|
return this.mappings.filter((map) =>
|
||||||
|
map.shortcuts.find((shortcut) =>
|
||||||
|
shortcut.keywords.find((key) =>
|
||||||
|
key.includes(this.search.toLowerCase())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hideModal() {
|
hideModal() {
|
||||||
this.$emit("hide-modal")
|
this.$emit("hide-modal")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<SmartModal
|
<SmartModal
|
||||||
v-if="show"
|
v-if="show"
|
||||||
:title="$t('support.title')"
|
:title="$t('support.title')"
|
||||||
|
placement="top"
|
||||||
@close="$emit('hide-modal')"
|
@close="$emit('hide-modal')"
|
||||||
>
|
>
|
||||||
<template #body>
|
<template #body>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
></div>
|
></div>
|
||||||
</transition>
|
</transition>
|
||||||
<span
|
<span
|
||||||
|
v-if="placement === 'center'"
|
||||||
class="hidden sm:h-screen sm:inline-block sm:align-middle"
|
class="hidden sm:h-screen sm:inline-block sm:align-middle"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>​</span
|
>​</span
|
||||||
@@ -44,8 +45,8 @@
|
|||||||
align-bottom
|
align-bottom
|
||||||
overflow-hidden
|
overflow-hidden
|
||||||
sm:max-w-md sm:align-middle
|
sm:max-w-md sm:align-middle
|
||||||
md:m-4
|
|
||||||
"
|
"
|
||||||
|
:class="{ 'mt-24': placement === 'top' }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="title"
|
v-if="title"
|
||||||
@@ -109,6 +110,10 @@ export default defineComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
placement: {
|
||||||
|
type: String,
|
||||||
|
default: "center",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const { disableKeybindings, enableKeybindings } = useKeybindingDisabler()
|
const { disableKeybindings, enableKeybindings } = useKeybindingDisabler()
|
||||||
|
|||||||
@@ -82,12 +82,26 @@ export const spotlight = [
|
|||||||
label: "shortcut.general.help_menu",
|
label: "shortcut.general.help_menu",
|
||||||
action: "modals.support.toggle",
|
action: "modals.support.toggle",
|
||||||
icon: "support",
|
icon: "support",
|
||||||
|
keywords: [
|
||||||
|
"help",
|
||||||
|
"support",
|
||||||
|
"documentation",
|
||||||
|
"troubleshooting",
|
||||||
|
"chat",
|
||||||
|
"community",
|
||||||
|
"feedback",
|
||||||
|
"report",
|
||||||
|
"bug",
|
||||||
|
"issue",
|
||||||
|
"ticket",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: [getPlatformSpecialKey(), "K"],
|
keys: [getPlatformSpecialKey(), "K"],
|
||||||
label: "shortcut.general.show_all",
|
label: "shortcut.general.show_all",
|
||||||
action: "flyouts.keybinds.toggle",
|
action: "flyouts.keybinds.toggle",
|
||||||
icon: "keyboard",
|
icon: "keyboard",
|
||||||
|
keywords: ["keyboard", "shortcuts"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -99,30 +113,51 @@ export const spotlight = [
|
|||||||
label: "shortcut.navigation.rest",
|
label: "shortcut.navigation.rest",
|
||||||
action: "navigation.rest.jump",
|
action: "navigation.rest.jump",
|
||||||
icon: "arrow_forward",
|
icon: "arrow_forward",
|
||||||
|
keywords: ["rest", "jump", "page", "navigation"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: [getPlatformAlternateKey(), "Q"],
|
keys: [getPlatformAlternateKey(), "Q"],
|
||||||
label: "shortcut.navigation.graphql",
|
label: "shortcut.navigation.graphql",
|
||||||
action: "navigation.graphql.jump",
|
action: "navigation.graphql.jump",
|
||||||
icon: "arrow_forward",
|
icon: "arrow_forward",
|
||||||
|
keywords: ["graphql", "jump", "page", "navigation"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: [getPlatformAlternateKey(), "W"],
|
keys: [getPlatformAlternateKey(), "W"],
|
||||||
label: "shortcut.navigation.realtime",
|
label: "shortcut.navigation.realtime",
|
||||||
action: "navigation.realtime.jump",
|
action: "navigation.realtime.jump",
|
||||||
icon: "arrow_forward",
|
icon: "arrow_forward",
|
||||||
|
keywords: [
|
||||||
|
"realtime",
|
||||||
|
"jump",
|
||||||
|
"page",
|
||||||
|
"navigation",
|
||||||
|
"websocket",
|
||||||
|
"socket",
|
||||||
|
"mqtt",
|
||||||
|
"sse",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: [getPlatformAlternateKey(), "D"],
|
keys: [getPlatformAlternateKey(), "D"],
|
||||||
label: "shortcut.navigation.documentation",
|
label: "shortcut.navigation.documentation",
|
||||||
action: "navigation.documentation.jump",
|
action: "navigation.documentation.jump",
|
||||||
icon: "arrow_forward",
|
icon: "arrow_forward",
|
||||||
|
keywords: ["documentation", "jump", "page", "navigation"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: [getPlatformAlternateKey(), "S"],
|
keys: [getPlatformAlternateKey(), "S"],
|
||||||
label: "shortcut.navigation.settings",
|
label: "shortcut.navigation.settings",
|
||||||
action: "navigation.settings.jump",
|
action: "navigation.settings.jump",
|
||||||
icon: "arrow_forward",
|
icon: "arrow_forward",
|
||||||
|
keywords: [
|
||||||
|
"settings",
|
||||||
|
"jump",
|
||||||
|
"page",
|
||||||
|
"navigation",
|
||||||
|
"account",
|
||||||
|
"theme",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user