Add Verdict Pillbar

This commit is contained in:
Samuel Lorch 2023-03-26 21:52:14 +02:00
parent 99abeab434
commit 5b6889cbae
3 changed files with 53 additions and 3 deletions

View 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>