From 7af9324a5e5831c1cc157c8d2e40540e43d0e6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Wed, 26 Mar 2025 22:01:19 +0100 Subject: [PATCH] Layout --- app.vue | 7 +++---- components/AppNavbar.vue | 19 ------------------- layouts/default.vue | 21 +++++++++++++++++++++ nuxt.config.ts | 8 ++++++++ 4 files changed, 32 insertions(+), 23 deletions(-) delete mode 100644 components/AppNavbar.vue create mode 100644 layouts/default.vue diff --git a/app.vue b/app.vue index 7fec1d5..848cc28 100644 --- a/app.vue +++ b/app.vue @@ -1,6 +1,5 @@ <template> - <client-only> - <app-navbar /> - </client-only> - <nuxt-page /> + <NuxtLayout> + <NuxtPage /> + </NuxtLayout> </template> diff --git a/components/AppNavbar.vue b/components/AppNavbar.vue deleted file mode 100644 index 3a72219..0000000 --- a/components/AppNavbar.vue +++ /dev/null @@ -1,19 +0,0 @@ -<script setup lang="ts"> -const { $keycloak } = useNuxtApp(); - -const login = () => { - $keycloak.login() -} - -const logout = () => { - $keycloak.logout({ redirectUri: location.origin + "/" }); -} - -</script> - -<template> - <div> - <button @click="logout" v-if="$keycloak.authenticated">Logout</button> - <button @click="login" v-else>Login</button> - </div> -</template> diff --git a/layouts/default.vue b/layouts/default.vue new file mode 100644 index 0000000..3a30b4d --- /dev/null +++ b/layouts/default.vue @@ -0,0 +1,21 @@ +<template> + +<div> + <button @click="$keycloak.logout()" v-if="$keycloak.authenticated">Logout</button> + <button @click="$keycloak.login()" v-else>Login</button> +</div> + +<slot /> +</template> + +<script> +const { $keycloak } = useNuxtApp(); + +export default { + name: 'default', + data () { + return { + } + }, +} +</script> diff --git a/nuxt.config.ts b/nuxt.config.ts index 6daffa5..4f38162 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -12,4 +12,12 @@ export default defineNuxtConfig({ }, }, +// app: { +// head: { +// link: [ +// { rel: 'stylesheet', href: 'https://styleguide.pirati.cz/2.9.1/css/styles.css' } +// ] +// } +// }, + }) -- GitLab