frontend/creating-a-sidebar #62
5 changed files with 87 additions and 117 deletions
|
@ -1,23 +1,28 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { RouterLink, RouterView } from 'vue-router';
|
import { ref } from 'vue'
|
||||||
import HeaderNav from './components/HeaderNav.vue';
|
import HeaderNav from './components/HeaderNav.vue'
|
||||||
import { BoltIcon } from 'lucide-vue-next';
|
import SideBar from './components/SideBar.vue'
|
||||||
|
import { RouterLink, RouterView } from 'vue-router'
|
||||||
|
|
||||||
const isTeacher = true;
|
const isTeacher = ref(true)
|
||||||
const isLoggedIn = true;
|
const isLoggedIn = ref(true)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header class="sticky top-0 z-50 bg-black w-full">
|
<div class="sticky top-0">
|
||||||
|
<header>
|
||||||
<HeaderNav :isLoggedIn="isLoggedIn" :isTeacher="isTeacher">
|
<HeaderNav :isLoggedIn="isLoggedIn" :isTeacher="isTeacher">
|
||||||
<template #left-icon>
|
<template #left-icon>
|
||||||
<BoltIcon class="icon" />
|
<BoltIcon class="icon" />
|
||||||
|
<!--Hier dann ein richtiges Logo rein-->
|
||||||
</template>
|
</template>
|
||||||
</HeaderNav>
|
</HeaderNav>
|
||||||
</header>
|
</header>
|
||||||
<div id="app" class="flex flex-col min-h-screen overflow-x-hidden">
|
</div>
|
||||||
<main class="flex-grow p-4">
|
<SideBar :isLoggedIn="isLoggedIn" :isTeacher="isTeacher" />
|
||||||
|
<div>
|
||||||
<RouterView />
|
<RouterView />
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
@import './base.css';
|
@import './base.css';
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
max-width: 1280px;
|
margin-left: 325px;
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a,
|
a,
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import TieredMenu from 'primevue/tieredmenu';
|
|
||||||
|
|
||||||
|
|
||||||
import { ref } from "vue";
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const items = ref([
|
|
||||||
{
|
|
||||||
label: 'HomeViw',
|
|
||||||
//icon: 'pi pi-home',
|
|
||||||
route: '/'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Student',
|
|
||||||
//icon: 'pi pi-graduation-cap',
|
|
||||||
route: '/Student'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Programmatic',
|
|
||||||
//icon: 'pi pi-link'
|
|
||||||
command: () => {
|
|
||||||
router.push('/introduction');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'External',
|
|
||||||
//icon: 'pi pi-home',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: 'Vue.js',
|
|
||||||
url: 'https://vuejs.org/'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Vite.js',
|
|
||||||
url: 'https://vuejs.org/'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<main>
|
|
||||||
<div class="card flex justify-center">
|
|
||||||
<TieredMenu :model="items">
|
|
||||||
<template #item="{ item, props, hasSubmenu }">
|
|
||||||
<router-link v-if="item.route" v-slot="{ href, navigate }" :to="item.route" custom>
|
|
||||||
<a v-ripple :href="href" v-bind="props.action" @click="navigate">
|
|
||||||
<span :class="item.icon" />
|
|
||||||
<!--span class="ml-2">{{ item.label }}</span-->
|
|
||||||
</a>
|
|
||||||
</router-link>
|
|
||||||
<a v-else v-ripple :href="item.url" :target="item.target" v-bind="props.action">
|
|
||||||
<!--span :class="item.icon" /-->
|
|
||||||
<span class="ml-2">{{ item.label }}</span>
|
|
||||||
<span v-if="hasSubmenu" class="pi pi-angle-right ml-auto" />
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</TieredMenu>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</main>
|
|
||||||
</template>
|
|
|
@ -1,26 +1,31 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { LogInIcon, LogOutIcon, BoltIcon } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
isLoggedIn: boolean
|
||||||
|
isTeacher: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav class="header-container">
|
<nav class="header-container">
|
||||||
<div class="left-icon">
|
<div class="left-icon">
|
||||||
|
<!-- Platzhalter für ein Icon -->
|
||||||
<slot name="left-icon"></slot>
|
<slot name="left-icon"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-items">
|
<div class="nav-items">
|
||||||
<button
|
<button v-if="!isLoggedIn" class="nav-button">
|
||||||
v-if="!isLoggedIn"
|
|
||||||
class="nav-button"
|
|
||||||
>
|
|
||||||
<component :is="LogInIcon" class="icon" />
|
<component :is="LogInIcon" class="icon" />
|
||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
<template v-if="isLoggedIn">
|
|
||||||
|
<template v-else>
|
||||||
<button class="nav-button">
|
<button class="nav-button">
|
||||||
<component :is="LogOutIcon" class="icon" />
|
<component :is="LogOutIcon" class="icon" />
|
||||||
Logout
|
Logout
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button v-if="isTeacher" class="nav-button">
|
||||||
v-if="isTeacher"
|
|
||||||
class="nav-button"
|
|
||||||
>
|
|
||||||
<component :is="BoltIcon" class="icon" />
|
<component :is="BoltIcon" class="icon" />
|
||||||
Lehrerverwaltung
|
Lehrerverwaltung
|
||||||
</button>
|
</button>
|
||||||
|
@ -29,35 +34,17 @@
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { LogInIcon, LogOutIcon, BoltIcon } from 'lucide-vue-next';
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
isLoggedIn: boolean;
|
|
||||||
isTeacher: boolean;
|
|
||||||
}>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.header-container {
|
.header-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-icon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-items {
|
.nav-items {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
align-items: center;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-button {
|
.nav-button {
|
||||||
|
@ -68,7 +55,6 @@ defineProps<{
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
|
50
frontend/src/components/SideBar.vue
Normal file
50
frontend/src/components/SideBar.vue
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import Drawer from 'primevue/drawer'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
isLoggedIn: boolean
|
||||||
|
isTeacher: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
var elements = [
|
||||||
|
{ name: 'Max', id: 25 },
|
||||||
|
{ name: 'Anna', id: 30 },
|
||||||
|
{ name: 'Tom', id: 35 },
|
||||||
|
]
|
||||||
|
var visible = ref(true)
|
||||||
|
var closeIcon = ref(false)
|
||||||
|
var counter = ref(null)
|
||||||
|
|
||||||
|
function setClass(input: Number) {}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Drawer
|
||||||
|
v-model:visible="visible"
|
||||||
|
:showCloseIcon="closeIcon"
|
||||||
|
:modal="false"
|
||||||
|
:dismissable="false"
|
||||||
|
v-on:hide="visible = true"
|
||||||
|
header="Sidebar"
|
||||||
|
v-if="isLoggedIn"
|
||||||
|
>
|
||||||
|
<div v-if="isTeacher">
|
||||||
|
<ul>
|
||||||
|
<li v-for="item in elements">
|
||||||
|
<a href="/about" @click="setClass(item.id)">{{ item.name }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/about">Offene/Abgegebene Evaluaionsbögen</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/about">Notenübersicht</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</Drawer>
|
||||||
|
</template>
|
Loading…
Add table
Reference in a new issue