Skip to content

Commit 65c357b

Browse files
authored
feat: add simple mobile menu (#11)
1 parent 8dd5c1e commit 65c357b

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

app/layouts/default.vue

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,27 @@ const ssr = useRouteQuery<string, boolean>('ssr', 'false', {
4949
const prod = useRouteQuery<string, boolean>('prod', 'false', {
5050
transform: stringToBooleanTransformer,
5151
})
52+
53+
const currentHref = shallowRef(location.href)
54+
const route = useRoute()
55+
56+
watch(() => route.fullPath, () => {
57+
currentHref.value = location.href
58+
})
59+
60+
const issueLink = computed(() => {
61+
return `https://github.com/vueuse/vueuse/issues/new?template=bug_report.yml&reproduction=${encodeURIComponent(currentHref.value)}`
62+
})
5263
</script>
5364

5465
<template>
5566
<UApp>
56-
<header class="flex items-center justify-around h-(--header-height)">
67+
<header class="flex items-center justify-between px-6 h-(--header-height)">
5768
<div class="flex gap-2 items-center">
5869
<UIcon name="i-logos-vueuse" class="size-8" />VueUse Playground
5970
</div>
6071

61-
<div class="flex gap-2 items-center">
72+
<div class="hidden lg:flex gap-2 items-center">
6273
<USwitch v-model="ssr" label="SSR" />
6374
<USwitch v-model="prod" label="Prod" />
6475
<USelectMenu v-model="vueUseVersion" :items="vueUseVersionsSorted" class="w-32" icon="i-logos-vueuse" :loading="loadingVersions" />
@@ -81,6 +92,60 @@ const prod = useRouteQuery<string, boolean>('prod', 'false', {
8192
aria-label="GitHub"
8293
/>
8394
</UTooltip>
95+
<UTooltip text="Report an issue on GitHub">
96+
<UButton
97+
color="neutral"
98+
variant="ghost"
99+
:to="issueLink"
100+
target="_blank"
101+
icon="i-pajamas-issue-new"
102+
aria-label="Issue via GitHub"
103+
/>
104+
</UTooltip>
105+
</div>
106+
<div class="lg:hidden">
107+
<UButton
108+
color="neutral" variant="ghost"
109+
:icon="colorMode.preference === 'dark' ? 'i-heroicons-moon' : 'i-heroicons-sun'"
110+
aria-label="color mode"
111+
@click="toggleColorMode"
112+
/>
113+
<UTooltip text="Open on GitHub">
114+
<UButton
115+
color="neutral"
116+
variant="ghost"
117+
to="https://github.com/vueuse"
118+
target="_blank"
119+
icon="i-simple-icons-github"
120+
aria-label="GitHub"
121+
/>
122+
</UTooltip>
123+
<USlideover title="Settings">
124+
<UButton icon="i-lucide-menu" color="neutral" variant="outline" />
125+
<template #body>
126+
<section class="flex flex-col gap-2 items-center justify-center">
127+
<div class="flex gap-2">
128+
<USwitch v-model="ssr" label="SSR" />
129+
<USwitch v-model="prod" label="Prod" />
130+
</div>
131+
<div class="flex gap-2">
132+
<USelectMenu v-model="vueUseVersion" :items="vueUseVersionsSorted" class="w-32" icon="i-logos-vueuse" :loading="loadingVersions" />
133+
<USelectMenu v-model="vueVersion" :items="vueVersionsSorted" class="w-32" icon="i-logos-vue" :loading="loadingVersions" />
134+
<UButton icon="i-lucide-refresh-ccw" size="md" color="primary" variant="soft" @click="fetchVersions" />
135+
</div>
136+
<UButton
137+
color="neutral"
138+
variant="ghost"
139+
:to="issueLink"
140+
target="_blank"
141+
icon="i-pajamas-issue-new"
142+
aria-label="Issue via GitHub"
143+
>
144+
Report an issue on GitHub
145+
</UButton>
146+
</section>
147+
</template>
148+
</USlideover>
84149
</div>
85150
</header>
86151

0 commit comments

Comments
 (0)