Files
swingmusic-extended/src/components/nav/NavBar.vue
T
geoffrey45 992d3a7003 fix 720p screens layout issue
~ add media queries
+ handle responsiveness on folder header
2022-08-11 02:53:24 +03:00

114 lines
2.3 KiB
Vue

<template>
<div class="topnav">
<div class="left">
<div class="btn">
<NavButtons />
</div>
<div class="info">
<APTitle v-show="showAPTitle" />
<Playlists v-show="$route.name == Routes.playlists" />
<Folder v-show="$route.name == Routes.folder" :subPaths="subPaths" />
</div>
</div>
<div class="center rounded">
<Loader />
</div>
<div class="right">
<Search />
</div>
</div>
</template>
<script setup lang="ts">
import NavButtons from "./NavButtons.vue";
import Loader from "../shared/Loader.vue";
import Search from "./Search.vue";
import { useRoute } from "vue-router";
import { ref, watch } from "vue";
import { Routes } from "@/composables/enums";
import { createSubPaths } from "@/utils";
import { subPath } from "@/interfaces";
import Folder from "./Titles/Folder.vue";
import Playlists from "./Titles/Playlists.vue";
import APTitle from "./Titles/APTitle.vue";
import useNavStore from "@/stores/nav";
import { computed } from "@vue/reactivity";
const route = useRoute();
const nav = useNavStore();
const subPaths = ref<subPath[]>([]);
const showAPTitle = computed(() => {
return (
(route.name == Routes.album || route.name == Routes.playlist) &&
!nav.h_visible
);
});
watch(
() => route.name,
(newRoute: string) => {
switch (newRoute) {
case Routes.folder:
let oldpath = "";
[oldpath, subPaths.value] = createSubPaths(
route.params.path as string,
oldpath
);
watch(
() => route.params.path,
(newPath) => {
newPath = newPath as string;
if (newPath == undefined) return;
[oldpath, subPaths.value] = createSubPaths(newPath, oldpath);
}
);
break;
default:
break;
}
}
);
</script>
<style lang="scss">
.topnav {
display: grid;
grid-template-columns: 1fr min-content max-content;
width: 100%;
.left {
display: grid;
grid-template-columns: max-content 1fr;
width: min-content;
overflow: scroll;
.info {
.title {
font-size: 1.5rem;
font-weight: bold;
display: flex;
}
}
}
.center {
display: grid;
place-items: center;
margin-right: 1rem;
}
.right {
width: 100%;
display: flex;
gap: $small;
}
}
</style>