mirror of
https://github.com/speatzle/nfsense.git
synced 2025-07-17 06:59:09 +00:00
Add Verdict Pillbar
This commit is contained in:
parent
99abeab434
commit
5b6889cbae
3 changed files with 53 additions and 3 deletions
44
client/src/components/inputs/pillbar.vue
Normal file
44
client/src/components/inputs/pillbar.vue
Normal file
|
@ -0,0 +1,44 @@
|
|||
<script setup lang="ts">
|
||||
|
||||
const props = defineModel<{
|
||||
options: {
|
||||
name: string,
|
||||
icon: Component,
|
||||
selected: boolean,
|
||||
}[],
|
||||
}>();
|
||||
let { options } = $(props);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'selectionChanged'): void
|
||||
}>();
|
||||
|
||||
function select(option: any) {
|
||||
for(let opt of options) {
|
||||
opt.selected = false;
|
||||
}
|
||||
option.selected = true;
|
||||
emit('selectionChanged');
|
||||
console.debug("selected", options);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<button class="option" v-for="(option, index) in options" :key="index" :class="{selected:option.selected}" @click="select(option)">
|
||||
<i class="material-icons" v-if="option.icon">{{ option.icon }}</i>
|
||||
{{ option.name }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
div {
|
||||
flex-flow: nowrap;
|
||||
}
|
||||
|
||||
.selected {
|
||||
background-color: var(--cl-bg-sl);
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue