-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
213 lines (199 loc) · 7.42 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<script setup>
import { ref, onBeforeMount } from "vue";
const router = useRouter();
const {page} = useContent()
const menu = ref({
Home: "/",
"Chi Siamo": {
"L'Associazione": "/associazione",
"Il Gruppo": "/gruppo",
"La Comunità Capi": "/coca",
"Il Progetto Educativo": "/progetto",
Contatti: "/contatti",
Iscrizioni: "/iscrizioni"
},
"Lupetti e Coccinelle": {
"La Branca L/C": "/lc/",
"Branco della Roccia Azzurra": "/lc/lupetti",
"Cerchio del Bosco Gioioso": "/lc/coccinelle",
"Piccole Orme": "/lc/piccole-orme",
Specialità: "/lc/specialita",
"Iniziazione Cristiana": "/lc/ic",
},
"Esploratori e Guide": {
"La Branca E/G": "/eg",
"Reparto Brownsea": "/eg/brownsea",
"Reparto Antares": "/eg/antares",
"Campi di Specialità e Competenza": "/eg/campetti",
"Specialità e Competenze": "/eg/specialita",
},
"Rover e Scolte": {
"La Branca R/S": "/rs/",
"Clan Fuoco MdV": "/rs/mdv",
Noviziato: "/rs/noviziato",
"Epppi/Ross": "/rs/epppi-ross",
},
Archivio: {
"Archivio Totem": "/totem",
"Staff del Passato": "/archivio-staff",
"Campi e Route": "/archivio-campi-route",
"Foto e Video": "/media",
},
Utilities: {
"Ricerca Codice Socio": "/codice-socio",
"Uniforme e Distintivi": "/uniforme",
"Traduttore Morse": "/morse",
"Materiali e link": "/materiale",
},
});
const regex = /^\/blog/;
const solid = regex.test(router.currentRoute.value.fullPath) || page.value?.navbar_solid;
const transparentNavbar = ref(!solid);
const fixedNavbar = ref(!solid);
const nuxtApp = useNuxtApp();
nuxtApp.hook("page:finish", () => {
if (!solid){
window.addEventListener("scroll", handleScroll);
}
});
function handleScroll() {
if (window.scrollY > 5) {
if (transparentNavbar.value) transparentNavbar.value = false;
} else {
if (!transparentNavbar.value) transparentNavbar.value = true;
}
}
useSeoMeta({
ogTitle: router.currentRoute.value.path != '/' ? page.value?.title + ' ~ Agesci Gruppo Mirandola 2' : 'Agesci Scout Mirandola 2 ~ 40 anni di giochi, avventure e strade!',
description: router.currentRoute.value.path == '/' ? 'Siamo a Mirandola dal 1983: scopri le ultime notizie, la nostra storia, i nostri Capi, i nomi totem, la galleria foto e video e una raccolta di strumenti utili.': page.value?.description,
ogDescription: router.currentRoute.value.path == '/' ? 'Siamo a Mirandola dal 1983: scopri le ultime notizie, la nostra storia, i nostri Capi, i nomi totem, la galleria foto e video e una raccolta di strumenti utili.': page.value?.description,
ogImage: router.currentRoute.value.path == '/' ? '/img/misc/hero.jpg' : page.value?.image,
})
</script>
<template>
<Head>
<Title>{{page?.title ? page?.title + ' ~ ' : 'Gruppo' }} Scout Mirandola 2 ~ Da più di 40 anni facciamo giochi, avventure e strade</Title>
</Head>
<link
rel="stylesheet" defer
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0,0"
/>
<div class="drawer drawer-end" tabindex="0">
<input id="my-drawer-3" type="checkbox" class="drawer-toggle" />
<main class="drawer-content flex flex-col min-h-screen">
<!-- Navbar -->
<div
class="navbar text-primary-content xl:top-0 z-50"
:class="{
fixed: fixedNavbar,
sticky: !fixedNavbar,
transparent: transparentNavbar,
'bg-primary shadow-md': !transparentNavbar,
}"
>
<div class="container max-w-none max-xl:px-5 xl:mx-auto">
<div class="flex-1 w-3/4 flex">
<h1 class="text-2xl my-auto font-bold">
<a href="/">
<NuxtImg placeholder src="/img/graphics/logo_white.svg" class="h-16 -ml-3 xl:ml-0" />
</a>
</h1>
</div>
<div class="flex-none hidden xl:block">
<ul class="menu menu-horizontal text-white">
<!-- Navbar menu content here -->
<template v-for="(submenu, mainItem) in menu" :key="mainItem">
<li>
<!-- Check if the submenu is an object -->
<template v-if="typeof submenu === 'object'">
<div
class="menu-dropdown-toggle dropdown dropdown-end dropdown-bottom dropdown-hover hover:text-[#dfd2ff]"
>
<label tabindex="0" class="">{{ mainItem }}</label>
<ul
tabindex="0"
class=" dropdown-content z-[1] menu p-2 shadow bg-secondary text-white rounded-box w-60"
>
<!-- Loop through the sub-menu items -->
<li v-for="(link, subItem) in submenu" :key="subItem">
<a :href="link">{{ subItem }}</a>
</li>
</ul>
</div>
</template>
<!-- If not an object, it's a direct link -->
<template v-else>
<a :href="submenu" class=" hover:text-[#dfd2ff]">{{
mainItem
}}</a>
</template>
</li>
</template>
</ul>
</div>
</div>
<div class="flex-none xl:hidden">
<label for="my-drawer-3" class="btn btn-square btn-ghost">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
class="inline-block w-6 h-6 stroke-current"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M4 6h16M4 12h16M4 18h16"
></path>
</svg>
</label>
</div>
</div>
<!-- Page content here -->
<NuxtPage />
<Footer />
</main>
<div class="drawer-side min-h-full z-50">
<label for="my-drawer-3" class="drawer-overlay"></label>
<div class="flex flex-row min-h-full">
<div class="bg-[#07ac0f] w-1"></div>
<div class="bg-[#ffee18] w-1"></div>
<div>
<ul
class="menu p-4 w-80 bg-secondary min-h-full overflow-y-scroll text-white"
>
<!-- Sidebar content here -->
<a href="/">
<NuxtImg placeholder src="/img/graphics/logo_white.svg" class="h-24 mb-8" alt="" />
</a>
<template v-for="(submenu, mainItem) in menu" :key="mainItem">
<!-- Check if the submenu is an object -->
<template v-if="typeof submenu === 'object'">
<li>
<details>
<summary>{{ mainItem }}</summary>
<ul>
<!-- Loop through the sub-menu items -->
<li v-for="(link, subItem) in submenu" :key="subItem">
<a :href="link">{{ subItem }}</a>
</li>
</ul>
</details>
</li>
</template>
<!-- If not an object, it's a direct link -->
<template v-else>
<li>
<a :href="submenu" class="hover:text-secondary">{{
mainItem
}}</a>
</li>
</template>
</template>
</ul>
</div>
</div>
</div>
</div>
</template>