Skip to content

Commit

Permalink
feat: btm-nav for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso committed Jan 7, 2025
1 parent dec2173 commit 07e7d8f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 33 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>zashboard</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
content="width=device-width, initial-scale=1.0,viewport-fit=cover"
/>
<meta
name="description"
Expand Down
43 changes: 20 additions & 23 deletions src/views/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,29 @@
:horizontal="true"
/>
<div class="relative h-0 flex-1">
<RouterView class="absolute h-full w-full" />
<RouterView
class="absolute h-full w-full"
:class="isPWA ? 'pb-[5.5rem]' : 'pb-14'"
/>
</div>
<div :class="`${isPWA ? 'h-20' : 'h-12'} shrink-0 md:hidden`"></div>
<div
ref="navBarRef"
:class="`fixed bottom-0 z-30 w-full bg-base-200 md:hidden ${isPWA ? 'h-20 pb-8' : 'h-12'}`"
:class="`btm-nav glass z-30 md:hidden ${isPWA ? 'h-20 pb-8' : 'h-12'}`"
>
<div class="flex h-12 w-full items-center justify-center gap-1 p-2">
<ul class="menu menu-horizontal flex flex-1">
<li
v-for="r in renderRoutes"
:key="r"
class="flex-1"
>
<a
class="flex items-center justify-center"
:class="r === route.name ? 'active' : 'inactive'"
:href="`#${r}`"
>
<component
:is="ROUTE_ICON_MAP[r]"
class="h-5 w-5"
/>
</a>
</li>
</ul>
</div>
<button
v-for="r in renderRoutes"
:key="r"
@click="router.push({ name: r })"
:class="r === route.name ? 'active bg-inherit' : ''"
>
<component
:is="ROUTE_ICON_MAP[r]"
class="h-5 w-5"
/>
<span class="text-xs">
{{ $t(r) }}
</span>
</button>
</div>
</div>

Expand Down Expand Up @@ -101,6 +97,7 @@ import { RouterView, useRoute, useRouter } from 'vue-router'
const modalRef = ref<HTMLDialogElement | null>(null)
const isPWA = (() => {
return 1
return window.matchMedia('(display-mode: standalone)').matches || navigator.standalone
})()
Expand Down
20 changes: 11 additions & 9 deletions src/views/RulesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
</div>
</template>
<template v-else>
<VirtualScroller :data="renderRules">
<template v-slot="{ item: rule }: { item: Rule }">
<RuleCard
:key="rule.payload"
:rule="rule"
:index="rules.indexOf(rule) + 1"
/>
</template>
</VirtualScroller>
<div>
<VirtualScroller :data="renderRules">
<template v-slot="{ item: rule }: { item: Rule }">
<RuleCard
:key="rule.payload"
:rule="rule"
:index="rules.indexOf(rule) + 1"
/>
</template>
</VirtualScroller>
</div>
</template>
</template>

Expand Down

0 comments on commit 07e7d8f

Please sign in to comment.