From 96019a4c8193358be365dd146fa412799accf099 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Sat, 10 Sep 2022 22:53:44 +0300 Subject: [PATCH] use reactive breakpoints to conditionally render right sidebar + use reactive content div width to remove big img on album page header --- package.json | 1 + src/App.vue | 22 +++++++--- src/assets/scss/Global/variants.scss | 2 +- src/components/AlbumView/Header.vue | 44 +++++++------------ src/components/FolderView/SongList.vue | 2 +- src/components/RightSideBar/SearchInput.vue | 12 ++--- .../useBreakpoints.ts} | 0 src/stores/content-width.ts | 11 +++++ yarn.lock | 9 ++++ 9 files changed, 59 insertions(+), 44 deletions(-) rename src/{stores/breakpoints.ts => composables/useBreakpoints.ts} (100%) create mode 100644 src/stores/content-width.ts diff --git a/package.json b/package.json index 9917e191..6b78a447 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@popperjs/core": "^2.11.6", + "@vueuse/components": "^9.2.0", "@vueuse/core": "^8.5.0", "@vueuse/integrations": "^9.2.0", "axios": "^0.26.1", diff --git a/src/App.vue b/src/App.vue index 1c069128..3f617134 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,7 @@ > -
+
@@ -26,11 +26,15 @@ import { onMounted } from "vue"; import { useRouter } from "vue-router"; import { onStartTyping } from "@vueuse/core"; +import { vElementSize } from "@vueuse/components"; import useQStore from "@/stores/queue"; import useModalStore from "@/stores/modal"; import useContextStore from "@/stores/context"; +import useSettingsStore from "@/stores/settings"; +import { xl } from "./composables/useBreakpoints"; import handleShortcuts from "@/composables/useKeyboard"; +import { readLocalStorage, writeLocalStorage } from "@/utils"; import Modal from "@/components/modal.vue"; import NavBar from "@/components/nav/NavBar.vue"; @@ -41,10 +45,7 @@ import RightSideBar from "@/components/RightSideBar/Main.vue"; import SearchInput from "@/components/RightSideBar/SearchInput.vue"; import NowPlayingRight from "@/components/RightSideBar/NowPlayingRight.vue"; import LeftSidebar from "./components/LeftSidebar/index.vue"; -import useSettingsStore from "@/stores/settings"; - -import { readLocalStorage, writeLocalStorage } from "@/utils"; -import { xl } from "./stores/breakpoints"; +import { content_width } from "@/stores/content-width"; const queue = useQStore(); const router = useRouter(); @@ -67,7 +68,6 @@ router.afterEach(() => { }); onStartTyping((e) => { - // if control is pressed return if (e.ctrlKey) { console.log("ctrl pressed"); } @@ -77,6 +77,16 @@ onStartTyping((e) => { elem.value = ""; }); +function updateContentElemSize({ + width, + height, +}: { + width: number; + height: number; +}) { + content_width.value = width; +} + function handleWelcomeModal() { let welcomeShowCount = readLocalStorage("shown-welcome-message"); diff --git a/src/assets/scss/Global/variants.scss b/src/assets/scss/Global/variants.scss index 4cbdfbcb..6980bb9d 100644 --- a/src/assets/scss/Global/variants.scss +++ b/src/assets/scss/Global/variants.scss @@ -25,5 +25,5 @@ } .shadow-lg { - box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.175); + box-shadow: 0 0 $medium rgba(0, 0, 0, 0.589); } diff --git a/src/components/AlbumView/Header.vue b/src/components/AlbumView/Header.vue index 57667e52..f555c358 100644 --- a/src/components/AlbumView/Header.vue +++ b/src/components/AlbumView/Header.vue @@ -16,10 +16,14 @@ >
@@ -35,7 +39,7 @@
-
+
{{ album.artist }} • {{ album.date }} • {{ album.count }} {{ album.count === 1 ? "Track" : "Tracks" }} • @@ -50,10 +54,9 @@
-
+
+ +
@@ -67,6 +70,7 @@ import useAlbumStore from "@/stores/pages/album"; import { playSources } from "../../composables/enums"; import { useVisibility, formatSeconds } from "@/utils"; import { getButtonColor, isLight } from "../../composables/colors/album"; +import { isSmall as widthIsSmall } from "@/stores/content-width"; import PlayBtnRect from "../shared/PlayBtnRect.vue"; @@ -107,20 +111,16 @@ useVisibility(albumheaderthing, handleVisibilityState); padding: 1rem; height: 100% !important; background-color: $black; - background-image: linear-gradient(37deg, $black 20%, $gray, $black 90%); overflow: hidden; - .bigimg { - height: 100%; + .big-img { + height: calc(100%); width: 16rem; - overflow: hidden; + margin: auto 0; img { height: 100%; aspect-ratio: 1; - - object-fit: cover; - object-position: bottom; } } @@ -169,25 +169,13 @@ useVisibility(albumheaderthing, handleVisibilityState); font-weight: bold; font-size: 0.8rem; margin-bottom: 0.75rem; - cursor: text; - div { width: fit-content; + cursor: text; } } } } - - @include for-desktop-down { - .art > img { - height: 6rem; - box-shadow: 0 0 1rem $black; - } - - .info > .top > .title { - font-size: 2rem; - } - } } diff --git a/src/components/FolderView/SongList.vue b/src/components/FolderView/SongList.vue index c40b5aa0..3045d3db 100644 --- a/src/components/FolderView/SongList.vue +++ b/src/components/FolderView/SongList.vue @@ -43,7 +43,7 @@