Added secondary menu test

This commit is contained in:
Alexis
2023-05-10 23:22:14 +02:00
parent 66c7ac1fca
commit f95e591585
5 changed files with 40 additions and 4 deletions

View File

@@ -4,7 +4,11 @@ import { RouterView } from 'vue-router'
<template> <template>
<div id="wrapper" class="py-16 px-8"> <div id="wrapper" class="py-16 px-8">
<RouterView /> <RouterView v-slot="{ Component }">
<Transition mode="out-in">
<component :is="Component" />
</Transition>
</RouterView>
</div> </div>
</template> </template>

View File

@@ -51,6 +51,7 @@ function handleInactiveState() {
> >
<YrhButton <YrhButton
has-square has-square
:href="item.href"
:has-arrow="item.id === clickedKey ? 'force' : true" :has-arrow="item.id === clickedKey ? 'force' : true"
:is-active="item.id === clickedKey" :is-active="item.id === clickedKey"
@mouseenter="handleActiveBtn($event, item)" @mouseenter="handleActiveBtn($event, item)"

View File

@@ -2,4 +2,5 @@ export interface MenuItem {
id: string id: string
label: string label: string
bannerText: string bannerText: string
href?: string
} }

0
src/views/DataView.vue Normal file
View File

View File

@@ -29,8 +29,35 @@ const availableRoutes: MenuItem[] = [
} }
] ]
const activeRoute = ref<string | null>('') const settingsOptions: MenuItem[] = [
{
id: 'dark-mode',
label: 'Dark Mode',
bannerText: 'Alter the terminal appearance'
},
{
id: 'language',
label: 'Language',
bannerText: 'Change terminal language'
},
{
id: 'audio',
label: 'Audio',
bannerText: 'Change audio settings'
},
{
id: 'video',
label: 'Video',
bannerText: 'Change video settings'
},
{
id: 'controls',
label: 'Controls',
bannerText: 'Change keyboard or gamepad controls'
}
]
const activeRoute = ref<string | null>('')
function switchActiveRoute(key: string | null) { function switchActiveRoute(key: string | null) {
activeRoute.value = key activeRoute.value = key
} }
@@ -43,7 +70,11 @@ function switchActiveRoute(key: string | null) {
<div> <div>
<YrhNav :items="availableRoutes" @change-nav="switchActiveRoute" /> <YrhNav :items="availableRoutes" @change-nav="switchActiveRoute" />
</div> </div>
<div>Secondary level (like settings)</div> <Transition name="fade" mode="out-in">
<YrhNav v-if="activeRoute === 'current-data'" :items="settingsOptions" />
<YrhNav v-else-if="activeRoute === 'settings'" :items="settingsOptions" />
<YrhNav v-else-if="activeRoute === 'credits'" :items="settingsOptions" />
</Transition>
</div> </div>
<div> <div>
<YrhBanner> <YrhBanner>
@@ -54,5 +85,4 @@ function switchActiveRoute(key: string | null) {
</YrhBanner> </YrhBanner>
</div> </div>
</main> </main>
{{ activeRoute }}
</template> </template>