Update nav + back buttons

This commit is contained in:
nicwands
2026-03-17 13:11:13 -04:00
parent 6f76c46299
commit 5c826e6b93
10 changed files with 42 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<div :class="classes" :style="styles"> <div :class="classes" :style="styles">
<Nav /> <Nav ref="nav" />
<Suspense> <Suspense>
<div class="layout-container"> <div class="layout-container">
@@ -17,18 +17,19 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted, watch } from 'vue'
import loadFonts from '@fuzzco/font-loader' import loadFonts from '@fuzzco/font-loader'
import { useWindowSize } from '@vueuse/core' import { useWindowSize, useElementBounding } from '@vueuse/core'
import Menu from '@/components/Menu.vue' import Menu from '@/components/Menu.vue'
import Nav from '@/components/Nav.vue' import Nav from '@/components/Nav.vue'
import MoveMenu from '@/components/MoveMenu.vue' import MoveMenu from '@/components/MoveMenu.vue'
import ScrollBar from '@/components/ScrollBar.vue' import ScrollBar from '@/components/ScrollBar.vue'
import useConfig from '@/composables/useConfig' import useConfig from '@/composables/useConfig'
const { height } = useWindowSize() const nav = ref()
// Theme state const { height } = useWindowSize()
const { height: navHeight } = useElementBounding(nav)
const { config } = useConfig() const { config } = useConfig()
const classes = computed(() => [ const classes = computed(() => [
@@ -60,6 +61,7 @@ onMounted(async () => {
const styles = computed(() => ({ const styles = computed(() => ({
'--vh': height.value ? height.value / 100 + 'px' : '100vh', '--vh': height.value ? height.value / 100 + 'px' : '100vh',
'--nav-height': navHeight.value + 'px',
})) }))
</script> </script>

View File

@@ -64,7 +64,7 @@ const openNewCategory = () => {}
.menu-wrap { .menu-wrap {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-top: 1.2em; padding-top: var(--nav-height);
padding-bottom: 10px; padding-bottom: 10px;
.menu-item { .menu-item {

View File

@@ -1,14 +1,30 @@
<template> <template>
<nav class="nav layout-block"> <nav class="nav layout-block">
<button @click="toggleMenu">Menu</button> <div class="left">
<router-link v-if="HAS_BACK_BUTTON.includes($route.name)" to="/"
><- Back</router-link
>
</div>
<router-link to="/search">Search</router-link> <div class="right">
<button @click="toggleMenu">Menu</button>
<router-link to="/search">Search</router-link>
</div>
</nav> </nav>
</template> </template>
<script setup> <script setup>
import useMenu from '@/composables/useMenu' import useMenu from '@/composables/useMenu'
const HAS_BACK_BUTTON = [
'category',
'create-category',
'instructions',
'search',
'preferences',
]
const { menuOpen, closeMenu, openMenu } = useMenu() const { menuOpen, closeMenu, openMenu } = useMenu()
const toggleMenu = () => { const toggleMenu = () => {
@@ -24,9 +40,16 @@ const toggleMenu = () => {
.nav { .nav {
position: absolute; position: absolute;
display: flex; display: flex;
align-items: center; justify-content: space-between;
gap: 10px;
padding-top: 9px; padding-top: 9px;
padding-bottom: 9px;
color: var(--grey-100); color: var(--grey-100);
.left,
.right {
display: flex;
align-items: center;
gap: 10px;
}
} }
</style> </style>

View File

@@ -1,7 +1,5 @@
<template> <template>
<main class="category layout-block"> <main class="category layout-block">
<router-link class="back" to="/"><- Go Back</router-link>
<category-row <category-row
:index="categoryIndex" :index="categoryIndex"
:category="id" :category="id"
@@ -61,13 +59,8 @@ const categoryIndex = computed(() => {
<style lang="scss"> <style lang="scss">
main.category { main.category {
padding-top: 1.24em; padding-top: var(--nav-height);
.back {
display: block;
opacity: 0.25;
margin-top: 9px;
}
.category-row { .category-row {
margin-top: 4px; margin-top: 4px;
} }

View File

@@ -17,6 +17,6 @@ const onCategoryEdited = (name) => {
<style lang="scss"> <style lang="scss">
.create-category { .create-category {
padding-top: 1.2em; padding-top: var(--nav-height);
} }
</style> </style>

View File

@@ -52,7 +52,7 @@ watch(notesChangeCount, async () => {
<style lang="scss"> <style lang="scss">
main.directory { main.directory {
padding-top: 26px; padding-top: var(--nav-height);
padding-bottom: 30px; padding-bottom: 30px;
.label { .label {

View File

@@ -1,7 +1,5 @@
<template> <template>
<main class="instructions layout-block"> <main class="instructions layout-block">
<router-link class="back-link" to="/"><- Go Back</router-link>
<div class="content" v-html="renderedContent" /> <div class="content" v-html="renderedContent" />
</main> </main>
</template> </template>
@@ -16,14 +14,7 @@ const renderedContent = md.render(content)
<style lang="scss"> <style lang="scss">
main.instructions { main.instructions {
padding-top: 1.2em; padding-top: var(--nav-height);
.back-link {
opacity: 0.25;
display: block;
margin-top: 9px;
margin-bottom: 14px;
}
.content { .content {
display: flex; display: flex;

View File

@@ -23,7 +23,7 @@ watchEffect(() => {
<style lang="scss"> <style lang="scss">
main.note { main.note {
padding-top: 2.2em; padding-top: var(--nav-height);
padding-bottom: 20px; padding-bottom: 20px;
} }
</style> </style>

View File

@@ -1,7 +1,5 @@
<template> <template>
<main class="preferences layout-block"> <main class="preferences layout-block">
<router-link to="/" class="back"><- Back</router-link>
<h1 class="mono">Storage Plugin</h1> <h1 class="mono">Storage Plugin</h1>
<div v-for="plugin in plugins" class="plugin" :key="plugin.id"> <div v-for="plugin in plugins" class="plugin" :key="plugin.id">
@@ -112,16 +110,9 @@ const save = async () => {
<style lang="scss"> <style lang="scss">
.preferences { .preferences {
padding-top: 1.2em; padding-top: var(--nav-height);
padding-bottom: 60px; padding-bottom: 60px;
.back {
opacity: 0.25;
display: block;
margin-top: 9px;
margin-bottom: 14px;
}
h1 { h1 {
margin-bottom: 20px; margin-bottom: 20px;
} }

View File

@@ -1,7 +1,5 @@
<template> <template>
<main class="search layout-block"> <main class="search layout-block">
<router-link class="back" to="/"><- Back</router-link>
<form @submit.prevent="onSearch"> <form @submit.prevent="onSearch">
<div class="input-wrap"> <div class="input-wrap">
<input <input
@@ -54,13 +52,8 @@ const onInput = _debounce(async () => {
<style lang="scss"> <style lang="scss">
main.search { main.search {
padding-top: 1.2em; padding-top: var(--nav-height);
.back {
display: block;
opacity: 0.25;
margin-top: 9px;
}
.input-wrap { .input-wrap {
margin-top: 19px; margin-top: 19px;
position: relative; position: relative;