Files
swingmusic-webclient/src/components/shared/DropDown.vue
Simon 6775b7abaf merge pr #37 from @Simonh2o
~ Added heart for favorited tracks, excluding the /favorites pages (#37) ~
* Added heart for favorited tracks, excluding the /favorites pages

* increased z-index of profile dropdown, some site elements were overlaying it

* very minor changes to btns, inputs, placeholders

* made search icon less intense

* various responsive fixes etc, isSmall on 724px for 'tracks'?

* Changed nav buttons slightly

* small fixes to heart pos, arrow pos context menu, active class for thumb nowplaying

* fixed children context menu cursor always being pointer

* Changes to profile dropdown

* some icons missing active animation, fixed padding play btn, right bar track pos, sidenav toggle

* fixed gradient animation for album and artist cards

* changed dropdown again

* hiding fav icon on lower viewport

* fixed some active click area bugs, and changed left side thumbnail

* right sidebar scrollbar and tracks fix

* adjusted topnav and bottombar sizing, change folder breadcrumb bg

* fixed some track titles for responsive

* playlist page small fixes

* Changes to the notification toasts

* Changed now playing controls responsive

* more space between bottom progress bar and play btns

---------

Co-authored-by: Stannnnn <stann@live.nl>
Co-authored-by: Mungai Njoroge <geoffreymungai45@gmail.com>
2024-11-21 13:57:31 +03:00

145 lines
3.4 KiB
Vue

<template>
<div class="smdropdown buttons" :class="component_key">
<div class="select rounded-sm">
<button
class="selected"
:class="{ showDropDown }"
@click.prevent="handleOpener"
:title="
reverse !== 'hide'
? `sort by: ${current.title} ${reverse ? 'Descending' : 'Ascending'}`.toUpperCase()
: undefined
"
>
<span class="ellip">{{ current.title }}</span>
<ArrowSvg :class="{ reverse }" class="dropdown-arrow" v-if="reverse !== 'hide'" />
</button>
<div v-if="showDropDown" ref="dropOptionsRef" class="options rounded no-scroll shadow-lg">
<div
v-for="item in items"
:key="item.key"
class="option"
:class="{ current: current.key == item.key }"
@click.prevent="handleClick(item)"
>
{{ item.title }}
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { onClickOutside } from '@vueuse/core'
import { Ref, ref } from 'vue'
import ArrowSvg from '@/assets/icons/arrow.svg'
const showDropDown = ref(false)
const dropOptionsRef: Ref<HTMLElement | undefined> = ref()
interface Item {
key: string
title: string
}
defineProps<{
items: Item[]
current: Item
component_key: string
reverse: boolean | 'hide'
}>()
const emit = defineEmits<{
(event: 'itemClicked', item: any): void
}>()
const handleOpener = () => {
showDropDown.value = !showDropDown.value
}
const handleClick = (item: any) => {
emit('itemClicked', item)
showDropDown.value = false
}
onClickOutside(dropOptionsRef, e => {
// @ts-ignore
e.stopImmediatePropagation()
showDropDown.value = false
})
</script>
<style lang="scss">
.smdropdown {
z-index: 1000;
.dropdown-arrow {
width: 100%;
aspect-ratio: 1;
}
.selected {
width: 100%;
display: grid;
grid-template-columns: 1fr 2rem;
gap: $smaller;
padding-left: $medium;
padding-right: 0;
text-transform: uppercase;
font-size: 12px !important;
background-color: transparent;
outline: solid 1px $gray5;
svg {
transform: rotate(90deg) scale(0.65);
}
svg.reverse {
transform: rotate(-90deg) scale(0.65);
}
&.showDropDown {
outline: solid 1px $gray2;
}
}
.select {
position: relative;
display: flex;
align-items: center;
font-size: calc($medium + 2px);
z-index: 10;
.options {
background-color: $gray;
position: absolute;
top: 120%;
padding: $small;
display: grid;
width: 100%;
}
.option {
font-weight: 500;
cursor: pointer;
padding: $small;
border-radius: $small;
transition: background-color 0.2s ease-out;
&:hover {
background-color: $gray5;
}
&:last-child {
border-bottom: none;
}
}
.current {
background-color: $gray4;
}
}
}
</style>