hide SEE ALL button when albums are few

+ remove album color from album card bg
This commit is contained in:
geoffrey45
2022-12-07 18:21:45 +03:00
committed by Mungai Njoroge
parent 5ebfd4df7f
commit 92172fe1c0
3 changed files with 14 additions and 80 deletions
+8 -4
View File
@@ -1,10 +1,8 @@
<template> <template>
<div <div class="artist-albums">
class="artist-albums"
>
<h3> <h3>
<span>{{ title }} </span> <span>{{ title }} </span>
<span class="see-more">SEE ALL</span> <span class="see-more" v-if="maxAbumCards <= albums.length">SEE ALL</span>
</h3> </h3>
<div class="cards"> <div class="cards">
<AlbumCard v-for="a in albums.slice(0, maxAbumCards)" :album="a" /> <AlbumCard v-for="a in albums.slice(0, maxAbumCards)" :album="a" />
@@ -45,5 +43,11 @@ defineProps<{
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
gap: 5rem 0; gap: 5rem 0;
} }
.album-card {
&:hover {
background-color: $gray;
}
}
} }
</style> </style>
@@ -1,42 +0,0 @@
<template>
<div class="albums-results bg-primary">
<div class="grid">
<PCard
v-for="album in search.albums.value"
:key="`${album.albumartists}-${album.title}`"
:album="album"
/>
</div>
<LoadMore v-if="search.albums.more" @loadMore="loadMore()" />
</div>
</template>
<script setup lang="ts">
import useSearchStore from "../../../stores/search";
const search = useSearchStore();
function loadMore() {
search.updateLoadCounter("albums");
search.loadAlbums(search.loadCounter.albums);
}
</script>
<style lang="scss">
.right-search .albums-results {
border-radius: 0.5rem;
margin-top: $small;
padding: $small;
overflow-x: hidden;
.result-item:hover {
background-color: $gray4;
}
.grid {
grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
flex-wrap: wrap;
gap: 0.75rem;
}
}
</style>
+6 -34
View File
@@ -1,22 +1,11 @@
<template> <template>
<router-link <RouterLink
:to="{ :to="{
name: 'AlbumView', name: 'AlbumView',
params: { hash: album.albumhash }, params: { hash: album.albumhash },
}" }"
class="result-item" class="album-card"
:class="{
nocontrast: album.colors ? isLight(album.colors[0]) : false,
}"
> >
<div
class="bg rounded"
:style="{
backgroundColor: `${
album.colors[0] ? album.colors[0] : 'rgb(72, 72, 74)'
}`,
}"
></div>
<div class="with-img"> <div class="with-img">
<img class="rounded-sm shadow-lg" :src="imguri + album.image" alt="" /> <img class="rounded-sm shadow-lg" :src="imguri + album.image" alt="" />
<PlayBtn <PlayBtn
@@ -41,17 +30,16 @@
</RouterLink> </RouterLink>
</div> </div>
</div> </div>
</router-link> </RouterLink>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { paths } from "../../config"; import { paths } from "../../config";
import { Album } from "../../interfaces"; import { Album } from "../../interfaces";
import { isLight } from "@/composables/colors/album";
import PlayBtn from "./PlayBtn.vue"; import PlayBtn from "./PlayBtn.vue";
import useAlbumStore from "@/stores/pages/album";
import { playSources, Routes } from "@/composables/enums"; import { playSources, Routes } from "@/composables/enums";
import useAlbumStore from "@/stores/pages/album";
const imguri = paths.images.thumb.large; const imguri = paths.images.thumb.large;
defineProps<{ defineProps<{
@@ -60,20 +48,13 @@ defineProps<{
</script> </script>
<style lang="scss"> <style lang="scss">
.result-item.nocontrast { .album-card {
&:hover {
color: $black;
}
}
.result-item {
display: grid; display: grid;
gap: $small; gap: $small;
padding: $medium; padding: $medium;
border-radius: 1rem; border-radius: 1rem;
height: fit-content; height: fit-content;
position: relative; position: relative;
color: $white;
.with-img { .with-img {
position: relative; position: relative;
@@ -103,17 +84,8 @@ defineProps<{
} }
} }
.bg {
height: 100%;
width: 100%;
position: absolute;
opacity: 0;
}
&:hover { &:hover {
.bg { background-color: $gray4;
opacity: 1;
}
} }
img { img {