mirror of
https://github.com/speatzle/nfsense.git
synced 2025-09-13 23:29:08 +00:00
add initial test client
This commit is contained in:
parent
0a51ba0beb
commit
fbc899fbe0
28 changed files with 4829 additions and 0 deletions
16
client/src/components/meta/PageHeader.vue
Normal file
16
client/src/components/meta/PageHeader.vue
Normal file
|
@ -0,0 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
const { title, noSpacer } = $(withDefaults(defineProps<{
|
||||
title?: string,
|
||||
noSpacer?: boolean,
|
||||
}>(), {
|
||||
title: "",
|
||||
noSpacer: false,
|
||||
}));
|
||||
watchEffect(() => useTitle(`${title} - nfSense`));
|
||||
</script>
|
||||
<template>
|
||||
<Portal to="page-header">
|
||||
<h1 v-if="title !== ''" v-text="title" :class="{'flex-grow': !noSpacer}"/>
|
||||
<slot/>
|
||||
</Portal>
|
||||
</template>
|
25
client/src/components/meta/Portal.vue
Normal file
25
client/src/components/meta/Portal.vue
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script lang="ts">
|
||||
let activeTargets = $ref<string[]>([]);
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = $defineProps<{
|
||||
from?: string,
|
||||
to?: string,
|
||||
}>();
|
||||
const { from, to } = $(props);
|
||||
|
||||
if (from) {
|
||||
onMounted(() => activeTargets.push(from));
|
||||
onBeforeUnmount(() => activeTargets.splice(activeTargets.indexOf(from), 1));
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="from" :id="'portal-' + from">
|
||||
<slot/>
|
||||
</div>
|
||||
<Teleport v-else-if="to && activeTargets.includes(to)" :to="'#portal-' + to">
|
||||
<slot/>
|
||||
</Teleport>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue