mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +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>
|
|
@ -128,8 +128,9 @@
|
||||||
/* More can be added as needed. */
|
/* More can be added as needed. */
|
||||||
--cl-fg: var(--cl-1-8); /* Foreground (Text, outlines) */
|
--cl-fg: var(--cl-1-8); /* Foreground (Text, outlines) */
|
||||||
--cl-bg: var(--cl-1-1); /* Background */
|
--cl-bg: var(--cl-1-1); /* Background */
|
||||||
--cl-bg-hl: var(--cl-1-2); /* Highlight Background (Component on Hover, select, ...) */
|
--cl-bg-hl: var(--cl-1-2); /* Highlight Background (Component on Hover, ...) */
|
||||||
--cl-bg-el: var(--cl-1-3); /* Element Background (Component) */
|
--cl-bg-el: var(--cl-1-3); /* Element Background (Component) */
|
||||||
|
--cl-bg-sl: var(--cl-1-4);
|
||||||
|
|
||||||
/* Table Color Assignments */
|
/* Table Color Assignments */
|
||||||
--cl-table-body: var(--cl-1-1);
|
--cl-table-body: var(--cl-1-1);
|
||||||
|
@ -150,6 +151,7 @@
|
||||||
--cl-bg: var(--cl-1-2);
|
--cl-bg: var(--cl-1-2);
|
||||||
--cl-bg-hl: var(--cl-1-3);
|
--cl-bg-hl: var(--cl-1-3);
|
||||||
--cl-bg-el: var(--cl-1-4);
|
--cl-bg-el: var(--cl-1-4);
|
||||||
|
--cl-bg-sl: var(--cl-1-5);
|
||||||
|
|
||||||
--cl-table-body: var(--cl-1-2);
|
--cl-table-body: var(--cl-1-2);
|
||||||
--cl-table-head: var(--cl-1-3);
|
--cl-table-head: var(--cl-1-3);
|
||||||
|
|
|
@ -8,6 +8,7 @@ async function doShit(){
|
||||||
let name = $ref("");
|
let name = $ref("");
|
||||||
let comment = $ref("");
|
let comment = $ref("");
|
||||||
let counter = $ref(false);
|
let counter = $ref(false);
|
||||||
|
let options = $ref([{name: 'Accept'}, {name: 'Drop'}, {name: 'Continue'}]);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ let counter = $ref(false);
|
||||||
<PageHeader title="Dashboard">
|
<PageHeader title="Dashboard">
|
||||||
<button @click="doShit">Example Buttons</button>
|
<button @click="doShit">Example Buttons</button>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
<form class="cl-secondary">
|
<form @submit="$event => $event.preventDefault()" class="cl-secondary">
|
||||||
<h3>Create Rule</h3>
|
<h3>Create Rule</h3>
|
||||||
<label for="name" v-text="'Name'"/>
|
<label for="name" v-text="'Name'"/>
|
||||||
<input name="name" v-model="name"/>
|
<input name="name" v-model="name"/>
|
||||||
|
@ -24,10 +25,13 @@ let counter = $ref(false);
|
||||||
<input name="counter" type="checkbox" v-model="counter"/>
|
<input name="counter" type="checkbox" v-model="counter"/>
|
||||||
<label for="comment" v-text="'Comment'"/>
|
<label for="comment" v-text="'Comment'"/>
|
||||||
<textarea name="comment" v-model="comment"></textarea>
|
<textarea name="comment" v-model="comment"></textarea>
|
||||||
|
<label for="verdict" v-text="'Verdict'"/>
|
||||||
|
<pillbar :options="options" name="verdict" ></pillbar>
|
||||||
<button>Submit</button>
|
<button>Submit</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
Loading…
Add table
Reference in a new issue