refactor UI layout

This commit is contained in:
geoffrey45
2022-03-06 10:27:01 +03:00
parent 90f8703a8e
commit 7f2102f931
21 changed files with 214 additions and 164 deletions
+13 -38
View File
@@ -2,70 +2,45 @@
<div class="r-sidebar">
<div class="grid">
<div class="r-content">
<div class="r-dash" v-show="current_tab === tabs.home">
<div class="r-dash" v-show="tabs.current === tabs.tabs.home">
<DashBoard />
</div>
<div class="r-search" v-show="current_tab === tabs.search">
<div class="r-search" v-show="tabs.current === tabs.tabs.search">
<Search />
</div>
<div class="r-queue" v-show="current_tab === tabs.queue">
<div class="r-queue" v-show="tabs.current === tabs.tabs.queue">
<UpNext />
</div>
</div>
<div class="tab-keys">
<Tabs :current_tab="current_tab" :tabs="tabs" @changeTab="changeTab" />
</div>
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
import Search from "./Search.vue";
import UpNext from "./Queue.vue";
import Tabs from "./Tabs.vue";
import Main from "./Home/Main.vue";
import perks from "../../composables/perks";
import useTabStore from "../../stores/tabs";
const DashBoard = Main;
const tabs = {
home: "home",
search: "search",
queue: "queue",
};
const default_tab = tabs.home;
const current_tab = ref(default_tab);
function changeTab(tab) {
new Promise((resolve) => {
current_tab.value = tab;
resolve();
setTimeout(() => {}, 300);
}).then(() => {
if (tab === tabs.queue) {
setTimeout(() => {
perks.focusCurrent();
}, 300);
}
});
}
const tabs = useTabStore();
</script>
<style lang="scss">
.r-sidebar {
width: 32em;
width: 29em;
background-color: rgba(4, 12, 34, 0.103);
padding: 0 0 0 $small;
border-left: 1px solid $gray;
@include phone-only {
display: none;
}
// @include tablet-landscape {
// width: 3rem;
// }
@include tablet-landscape {
display: none;
}
.grid {
height: 100%;
@@ -76,7 +51,6 @@ function changeTab(tab) {
grid-area: content;
width: 29rem;
// @include tablet-landscape {
// display: none;
// }
@@ -95,6 +69,7 @@ function changeTab(tab) {
}
.tab-keys {
display: none;
width: 3rem;
right: 0;
height: 100%;
+28 -34
View File
@@ -1,47 +1,44 @@
<template>
<div class="r-tabs">
<div v-for="tab in props.tabs"
@click="changeTab(tab)"
:key="tab"
class="image t-item"
:class="{ active_tab: props.current_tab === tab }, `${tab}`"
></div>
<div>
<div class="tabs">
<div class="cont rounded">
<div
v-for="tab in tabs.tabs"
@click="tabs.changeTab(tab)"
:key="tab"
class="image t-item"
:class="({ active_tab: tabs.current === tab }, `${tab}`)"
></div>
</div>
</div>
</template>
<script setup>
import useTabStore from "../../stores/tabs";
const props = defineProps({
current_tab: String,
tabs: Object,
});
const emit = defineEmits(['changeTab'])
function changeTab(tab) {
if (tab === props.current_tab) return;
emit('changeTab', tab)
}
const tabs = useTabStore()
</script>
<style lang="scss">
.r-tabs {
display: flex;
flex-direction: column;
gap: $small;
margin-top: $small;
margin-left: $small;
.tabs {
padding: $small;
border-left: 1px solid $gray;
.cont {
background-color: $gray;
display: flex;
gap: $small;
height: 100%;
align-items: center;
padding-left: $small;
}
.t-item {
float: right;
width: 100%;
height: 2.45rem;
width: 2.25rem;
height: 2.25rem;
background-size: 1.5rem;
border-radius: $small 0 0 $small;
border-radius: $small;
background-color: $gray4;
&:hover {
background-color: rgba(128, 128, 128, 0.281);
@@ -49,23 +46,20 @@ function changeTab(tab) {
}
.active_tab {
border-right: solid;
border: solid;
background-color: rgba(17, 123, 223, 0.192);
}
.search {
background-image: url("../../assets/icons/search.svg");
// background-color: rgba(35, 35, 66, 0.247);
}
.queue {
background-image: url("../../assets/icons/queue.svg");
// background-color: rgba(46, 25, 33, 0.445);
}
.home {
background-image: url("../../assets/icons/dashboard.svg");
// background-color: rgba(148, 102, 50, 0.445);
}
}
</style>