use directive to add tooltip

+ change grid size for search page
+
This commit is contained in:
geoffrey45
2022-09-04 12:48:56 +03:00
parent 4861429e4e
commit 24bfa73ab6
16 changed files with 111 additions and 81 deletions
+2 -1
View File
@@ -25,7 +25,7 @@
<span v-else-if="album.is_single">Single</span>
<span v-else>Album</span>
</div>
<div class="title ellip">
<div class="title ellip" v-tooltip="album.title">
{{ album.title }}
</div>
</div>
@@ -141,6 +141,7 @@ useVisibility(albumheaderthing, handleVisibilityState);
.title {
font-size: 2.5rem;
font-weight: 600;
width: fit-content;
}
.artist {
+1 -1
View File
@@ -1,6 +1,6 @@
<template>
<div
class="table rounded border"
class="table rounded"
v-if="tracks.length"
ref="tracklistElem"
:class="{
+1 -1
View File
@@ -1,5 +1,5 @@
<template>
<div class="l-sidebar rounded border">
<div class="l-sidebar">
<div class="withlogo">
<Logo />
<Navigation />
@@ -51,7 +51,7 @@ defineProps<{
.search-results-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
gap: 0.75rem;
}
</style>
+4 -3
View File
@@ -8,7 +8,7 @@
>
<img class="rounded" :src="imguri + album.image" alt="" />
<div>
<h4 class="title ellip">{{ album.title }}</h4>
<h4 class="title ellip" v-tooltip="album.title">{{ album.title }}</h4>
<div class="artist ellip">{{ album.artist }}</div>
</div>
</router-link>
@@ -30,7 +30,7 @@ defineProps<{
gap: $small;
padding: $small;
transition: all 0.5s ease;
border-radius: .7rem;
border-radius: 0.7rem;
img {
width: 100%;
@@ -44,12 +44,13 @@ defineProps<{
.title {
margin-bottom: $smaller;
font-size: 0.9rem;
width: fit-content;
}
.artist {
font-size: 0.8rem;
text-align: left;
opacity: .75;
opacity: 0.75;
}
}
</style>
+5 -5
View File
@@ -42,10 +42,10 @@ defineProps<{
object-fit: cover;
}
&:hover {
.artist-image {
border-radius: 20%;
}
}
// &:hover {
// .artist-image {
// border-radius: 10%;
// }
// }
}
</style>
+18 -6
View File
@@ -1,17 +1,29 @@
<template>
<div class="ellip" v-if="artists[0] !== ''">
<span v-for="artist in putCommas(artists)" :key="artist">{{ artist }}</span>
</div>
<div class="ellip" v-else>
<span>{{ albumartist }}</span>
<div v-tooltip="returnArtists()" style="width: auto;">
<div class="ellip" v-if="artists[0] !== '' && artists.length > 1">
<span v-for="artist in putCommas(artists)" :key="artist">{{
artist
}}</span>
</div>
<div class="ellip" v-else>
<span>{{ albumartist }}</span>
</div>
</div>
</template>
<script setup lang="ts">
import { putCommas } from "@/utils";
defineProps<{
const props = defineProps<{
artists: string[];
albumartist: string | undefined;
}>();
function returnArtists() {
if (props.artists[0] !== "" && props.artists.length > 1) {
return props.artists.join(", ");
} else {
return props.albumartist;
}
}
</script>
+6 -49
View File
@@ -20,7 +20,7 @@
:class="{ last_played: !isPlaying }"
></div>
</div>
<div @mouseover="showToolTip" @mouseleave="hideToolTip">
<div v-tooltip="track.title">
<div class="title ellip" @click="emitUpdate(track)" ref="artisttitle">
{{ track.title }}
</div>
@@ -30,9 +30,6 @@
:albumartist="track.albumartist"
/>
</div>
<div class="tooltip" ref="tooltip">
{{ track.title }}
</div>
</div>
</div>
<div class="song-artists">
@@ -40,6 +37,7 @@
</div>
<router-link
class="song-album ellip"
v-tooltip="track.album"
:to="{
name: 'AlbumView',
params: {
@@ -64,7 +62,6 @@
<script setup lang="ts">
import { ref } from "vue";
import { createPopper } from "@popperjs/core";
import OptionSvg from "@/assets/icons/more.svg";
@@ -99,38 +96,6 @@ function emitUpdate(track: Track) {
function showMenu(e: Event) {
showContext(e, props.track, options_button_clicked);
}
let isHovering = false;
function showToolTip() {
isHovering = true;
setTimeout(() => {
if (isHovering) {
const ttip = tooltip.value as HTMLElement;
const atitle = artisttitle.value as HTMLElement;
ttip.style.display = "unset";
createPopper(atitle, ttip, {
placement: "top",
modifiers: [
{
name: "offset",
options: {
offset: [10, 10],
},
},
],
});
}
}, 500);
}
function hideToolTip() {
(tooltip.value as HTMLElement).style.display = "none";
isHovering = false;
}
</script>
<style lang="scss">
@@ -143,17 +108,6 @@ function hideToolTip() {
gap: 1rem;
user-select: none;
.tooltip {
background-color: $darkestblue;
border-radius: $smaller;
padding: $smaller;
font-size: 0.85rem;
display: none;
position: absolute;
margin: 1rem;
z-index: 300;
}
&:hover {
background-color: $gray4;
@@ -172,6 +126,9 @@ function hideToolTip() {
}
.song-artists {
width: fit-content;
max-width: 100%;
.artist {
cursor: pointer;
}
@@ -181,7 +138,7 @@ function hideToolTip() {
opacity: 0.5;
font-size: 0.8rem;
width: 100%;
margin-left: $small;
// margin-left: $small;
}
.song-duration {
+8 -2
View File
@@ -19,7 +19,7 @@
></div>
</div>
<div class="tags">
<div class="title ellip">
<div class="title ellip" v-tooltip="track.title">
{{ track.title }}
</div>
<hr />
@@ -94,6 +94,12 @@ const playThis = (track: Track) => {
align-items: center;
padding: $small 1rem;
.tags {
.title {
width: fit-content;
}
}
.remove-track {
opacity: 0;
transition: all 0.25s ease;
@@ -139,7 +145,7 @@ const playThis = (track: Track) => {
.artist {
font-size: small;
opacity: .67;
opacity: 0.67;
}
}
</style>