Add menu button for opening the settings

This commit is contained in:
2022-04-30 23:08:29 +02:00
parent a7a505b694
commit 8c64568077
3 changed files with 22 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import MenuIcon from "./icons/menu-icon.vue"; import MenuIcon from "./icons/menu-icon.vue";
import { computed } from "vue"; import { computed } from "vue";
import { useRoute } from "vue-router"; import { useRoute, RouterLink } from "vue-router";
const route = useRoute(); const route = useRoute();
const routeName = computed(() => route.name); const routeName = computed(() => route.name);
@ -11,7 +11,9 @@ const routeName = computed(() => route.name);
<div class="titlebar"> <div class="titlebar">
<span class="title">{{ routeName }}</span> <span class="title">{{ routeName }}</span>
<div class="settings"> <div class="settings">
<MenuIcon /> <RouterLink to="/settings">
<MenuIcon />
</RouterLink>
</div> </div>
</div> </div>
</template> </template>
@ -38,4 +40,16 @@ const routeName = computed(() => route.name);
justify-content: right; justify-content: right;
padding-right: 13px; padding-right: 13px;
} }
a {
display: inherit;
text-decoration: none;
color: inherit;
padding: 4px;
}
a.router-link-active {
background-color: #335723;
border-radius: 5px;
}
</style> </style>

View File

@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from "vue-router";
import TimetableView from "../views/TimetableView.vue"; import TimetableView from "../views/TimetableView.vue";
import SubstitutionView from "../views/SubstitutionView.vue"; import SubstitutionView from "../views/SubstitutionView.vue";
import HistoryView from "../views/HistoryView.vue"; import HistoryView from "../views/HistoryView.vue";
import SettingsView from "../views/SettingsView.vue";
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
@ -25,6 +26,11 @@ const router = createRouter({
name: "History", name: "History",
component: HistoryView, component: HistoryView,
}, },
{
path: "/settings",
name: "Settings",
component: SettingsView,
},
], ],
}); });

View File