add a click to expand area

This commit is contained in:
geoffrey45 2022-07-02 09:58:51 +03:00 committed by Mungai Geoffrey
parent 714775a67e
commit 30020423d1
2 changed files with 65 additions and 18 deletions

View File

@ -49,17 +49,14 @@ const scrollRight = () => {
<style lang="scss"> <style lang="scss">
.f-artists { .f-artists {
height: 14.5em;
width: calc(100%); width: calc(100%);
padding: $small; padding: 0 $small;
padding-bottom: 0;
border-radius: $small; border-radius: $small;
user-select: none; user-select: none;
position: relative; position: relative;
.header { .header {
display: flex; display: flex;
height: 2.5rem;
align-items: center; align-items: center;
position: relative; position: relative;
@ -78,11 +75,11 @@ const scrollRight = () => {
right: 0; right: 0;
display: flex; display: flex;
gap: 1rem; gap: 1rem;
justify-content: space-between;
.prev { .prev {
transform: rotate(180deg); transform: rotate(180deg);
} }
.icon { .icon {
border-radius: $small; border-radius: $small;
cursor: pointer; cursor: pointer;

View File

@ -11,12 +11,23 @@
id="bottom-items" id="bottom-items"
class="rounded" class="rounded"
ref="albumbottomcards" ref="albumbottomcards"
@click="expandBottom" :class="{
bottomexpanded: !bottomContainerState,
}"
> >
<FeaturedArtists :artists="album.artists" /> <div class="click-to-expand" @click="toggleBottom">
<div v-if="album.bio"> <div>
<div class="separator" id="av-sep"></div> <div class="arrow"></div>
<AlbumBio :bio="album.bio" /> <span>tap here</span>
</div>
</div>
<div class="bottom-content">
<FeaturedArtists :artists="album.artists" />
<div v-if="album.bio">
<div class="separator" id="av-sep"></div>
<AlbumBio :bio="album.bio" />
</div>
<div class="dummy"></div>
</div> </div>
</div> </div>
</div> </div>
@ -29,10 +40,9 @@ import AlbumBio from "../components/AlbumView/AlbumBio.vue";
import SongList from "../components/FolderView/SongList.vue"; import SongList from "../components/FolderView/SongList.vue";
import FeaturedArtists from "../components/PlaylistView/FeaturedArtists.vue"; import FeaturedArtists from "../components/PlaylistView/FeaturedArtists.vue";
import useAStore from "../stores/pages/album"; import useAStore from "../stores/pages/album";
import { onBeforeRouteUpdate } from "vue-router"; import { onBeforeRouteUpdate } from "vue-router";
import { ref } from "vue"; import { reactive, ref } from "vue";
const album = useAStore(); const album = useAStore();
const albumbottomcards = ref<HTMLElement>(null); const albumbottomcards = ref<HTMLElement>(null);
@ -42,10 +52,13 @@ onBeforeRouteUpdate(async (to) => {
album.fetchBio(to.params.hash.toString()); album.fetchBio(to.params.hash.toString());
}); });
function expandBottom() { function toggleBottom() {
const elem = albumbottomcards.value; // const elem = albumbottomcards.value;
elem.style.height = `${40}rem`; // elem.style.height = `${40}rem`;
bottomContainerState.value = !bottomContainerState.value;
} }
const bottomContainerState = ref(true);
</script> </script>
<style lang="scss"> <style lang="scss">
@ -76,16 +89,53 @@ function expandBottom() {
#bottom-items { #bottom-items {
z-index: 77; z-index: 77;
padding: $small;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
height: 15rem; height: 15rem;
max-height: 35rem;
overflow: hidden;
background-color: $gray; background-color: $gray;
transition: all 0.5s ease; transition: all 0.5s ease;
overscroll-behavior: contain; overscroll-behavior: contain;
display: grid;
grid-template-rows: 2rem 1fr;
.click-to-expand {
height: 1.5rem;
display: flex;
align-items: center;
div {
margin: 0 auto;
font-size: small;
color: $gray1;
cursor: default;
user-select: none;
display: flex;
gap: $small;
}
.arrow {
max-width: min-content;
transition: all 0.2s ease-in-out;
}
}
}
.bottomexpanded {
height: 35rem !important;
.arrow {
transform: rotate(180deg) !important;
}
.bottom-content {
overflow: auto;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
} }
} }
</style> </style>