Compare commits

...

3 commits

Author SHA1 Message Date
dd936a1d0a WIP 2023-04-27 17:49:07 +02:00
a0204e4da4 Change nav header to be app specific
Update content to match app requirements.
2023-04-27 17:29:26 +02:00
9a2861fc3f Move HomeView layout into DefaultLayout.vue
This is to make it easier to have the same layout on all views.
2023-04-27 17:25:34 +02:00
6 changed files with 58 additions and 36 deletions

View file

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import TableComponent from './TableComponent.vue';
const { tableHeader, tableRows } = defineProps<{ tableHeader: string[], tableRows: any[][] }>() const { tableHeader, tableRows } = defineProps<{ tableHeader: string[], tableRows: any[][] }>()
</script> </script>
<template> <template>
@ -6,31 +7,8 @@ const { tableHeader, tableRows } = defineProps<{ tableHeader: string[], tableRow
<h1 class="text-xl normal-case">Allowed Servers</h1> <h1 class="text-xl normal-case">Allowed Servers</h1>
<button class="btn btn-circle btn-success">Add</button> <button class="btn btn-circle btn-success">Add</button>
</div> </div>
<div class="overflow-x-auto"> <TableComponent :tableHeader="tableHeader" :tableRows="tableRows">
<table class="table w-full">
<!-- head -->
<thead>
<tr>
<template v-for="header in tableHeader">
<th>{{ header }}</th>
</template>
<th>Action</th>
</tr>
</thead>
<tbody>
<!-- row -->
<tr>
<template v-for="rows in tableRows">
<template v-for="data in rows">
<th>{{ data }}</th>
</template>
</template>
<th>
<button class="btn btn-sm btn-info m-1">Edit</button> <button class="btn btn-sm btn-info m-1">Edit</button>
<button class="btn btn-sm btn-error m-1">Delete</button> <button class="btn btn-sm btn-error m-1">Delete</button>
</th> </TableComponent>
</tr>
</tbody>
</table>
</div>
</template> </template>

View file

@ -2,7 +2,7 @@
<header> <header>
<div class="navbar bg-base-100"> <div class="navbar bg-base-100">
<div class="flex-1"> <div class="flex-1">
<a class="btn btn-ghost normal-case text-xl">daisyUI</a> <a class="btn btn-ghost normal-case text-xl"><RouterLink to="/">dchat</RouterLink></a>
</div> </div>
<div class="flex-none"> <div class="flex-none">
<ul class="menu menu-horizontal px-1"> <ul class="menu menu-horizontal px-1">
@ -11,11 +11,6 @@
<RouterLink to="/login">Login</RouterLink> <RouterLink to="/login">Login</RouterLink>
</a> </a>
</li> </li>
<li>
<a>
<RouterLink to="/">Home</RouterLink>
</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -0,0 +1,31 @@
<script lang="ts" setup>
const { tableHeader, tableRows } = defineProps<{ tableHeader: string[], tableRows: any[][] }>()
</script>
<template>
<div class="overflow-x-auto">
<table class="table w-full">
<!-- head -->
<thead>
<tr>
<template v-for="header in tableHeader">
<th>{{ header }}</th>
</template>
<th>Action</th>
</tr>
</thead>
<tbody>
<!-- row -->
<tr>
<template v-for="rows in tableRows">
<template v-for="data in rows">
<th>{{ data }}</th>
</template>
</template>
<th>
<slot />
</th>
</tr>
</tbody>
</table>
</div>
</template>

View file

@ -0,0 +1,9 @@
<template>
<Nav />
<slot />
</template>
<script setup>
import Nav from "../components/Nav.vue"
</script>

View file

@ -1,10 +1,11 @@
<template> <template>
<Nav /> <DefaultLayout>
<AllowedServers :tableHeader="tableHeader" :tableRows="tableRows" /> <AllowedServers :tableHeader="tableHeader" :tableRows="tableRows" />
</DefaultLayout>
</template> </template>
<script setup> <script setup>
import Nav from "../components/Nav.vue" import DefaultLayout from "../layouts/DefaultLayout.vue"
import AllowedServers from "../components/AllowedServers.vue" import AllowedServers from "../components/AllowedServers.vue"
const tableHeader = ["ID", "User", "Comment", "Date"] const tableHeader = ["ID", "User", "Comment", "Date"]

View file

@ -0,0 +1,8 @@
<script setup lang="ts">
import DefaultLayout from "../../layouts/DefaultLayout.vue"
</script>
<template>
<DefaultLayout>
</DefaultLayout>
</template>