Implement menu bar floating list menus (#163)

Progress towards #135
This commit is contained in:
Keavon Chambers
2021-05-31 11:51:32 -07:00
committed by GitHub
parent 83984700bf
commit ad9feda054
16 changed files with 482 additions and 58 deletions
@@ -1,12 +1,15 @@
<template>
<div class="user-input-label">
<span class="input-key" v-for="inputKey in inputKeys" :key="inputKey" :class="keyCapWidth(inputKey)">
{{ inputKey }}
</span>
<template v-for="(keyGroup, keyGroupIndex) in inputKeys" :key="keyGroupIndex">
<span class="group-gap" v-if="keyGroupIndex > 0"></span>
<span class="input-key" v-for="inputKey in keyGroup" :key="inputKey" :class="keyCapWidth(inputKey)">
{{ inputKey }}
</span>
</template>
<span class="input-mouse" v-if="inputMouse">
<Icon :icon="mouseInputInteractionToIcon(inputMouse)" />
</span>
<span class="hint-text">
<span class="hint-text" v-if="hasSlotContent">
<slot></slot>
</span>
</div>
@@ -20,17 +23,22 @@
align-items: center;
white-space: nowrap;
.group-gap {
width: 4px;
}
.input-key,
.input-mouse {
margin-right: 4px;
& + .input-key,
& + .input-mouse {
margin-left: 2px;
}
}
.input-key {
font-family: "Inconsolata", monospace;
font-weight: bold;
text-align: center;
color: var(--color-2-mildblack);
background: var(--color-e-nearwhite);
color: var(--color-e-nearwhite);
border: 1px;
box-sizing: border-box;
border-style: solid;
@@ -73,6 +81,10 @@
vertical-align: top;
}
}
.hint-text {
margin-left: 4px;
}
}
</style>
@@ -99,6 +111,11 @@ export default defineComponent({
inputKeys: { type: Array, default: () => [] },
inputMouse: { type: String },
},
computed: {
hasSlotContent(): boolean {
return Boolean(this.$slots.default);
},
},
methods: {
keyCapWidth(keyText: string) {
return `width-${keyText.length * 8 + 8}`;