feat(ui): Split playbutton can be seperate dropdown only using optionsbutton
This commit is contained in:
parent
9ba8f1d5e2
commit
c6854d8ceb
|
@ -11,6 +11,7 @@ import { useRouter, useRoute } from 'vue-router'
|
||||||
import { color } from "~/composables/color.ts";
|
import { color } from "~/composables/color.ts";
|
||||||
|
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
|
import OptionsButton from '~/components/ui/button/Options.vue'
|
||||||
import Popover from '~/components/ui/Popover.vue'
|
import Popover from '~/components/ui/Popover.vue'
|
||||||
import PopoverItem from '~/components/ui/popover/PopoverItem.vue'
|
import PopoverItem from '~/components/ui/popover/PopoverItem.vue'
|
||||||
|
|
||||||
|
@ -111,16 +112,26 @@ const isOpen = ref(false)
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Popover v-if="!discrete && !iconOnly" v-model:open="isOpen">
|
<Popover v-if="!discrete && !iconOnly" v-model:open="isOpen">
|
||||||
|
<OptionsButton
|
||||||
|
v-if="dropdownOnly"
|
||||||
|
@click="isOpen = !isOpen"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
v-if="!dropdownOnly"
|
v-else
|
||||||
v-bind="{disabled: !playable, primary: playable}"
|
v-bind="{
|
||||||
split
|
disabled: !playable,
|
||||||
splitIcon="bi-caret-down-fill"
|
primary: playable,
|
||||||
|
split: true,
|
||||||
|
splitIcon: 'bi-caret-down-fill',
|
||||||
|
splitTitle: title
|
||||||
|
}"
|
||||||
:aria-label="labels.replacePlay"
|
:aria-label="labels.replacePlay"
|
||||||
:class="[...buttonClasses, 'ui', {loading: isLoading, 'mini': discrete}]"
|
:class="[...buttonClasses]"
|
||||||
|
:isloading="isLoading"
|
||||||
|
:dropdownOnly="dropdownOnly"
|
||||||
|
:tiny="discrete"
|
||||||
@click.stop.prevent="replacePlay()"
|
@click.stop.prevent="replacePlay()"
|
||||||
@split-click="isOpen = !isOpen"
|
@split-click="isOpen = !isOpen"
|
||||||
:split-title="title"
|
|
||||||
>
|
>
|
||||||
<template #main>
|
<template #main>
|
||||||
<i
|
<i
|
||||||
|
|
|
@ -9,6 +9,7 @@ import usePlayOptions from '~/composables/audio/usePlayOptions'
|
||||||
import TrackFavoriteIcon from '~/components/favorites/TrackFavoriteIcon.vue'
|
import TrackFavoriteIcon from '~/components/favorites/TrackFavoriteIcon.vue'
|
||||||
import PlayIndicator from '~/components/audio/track/PlayIndicator.vue'
|
import PlayIndicator from '~/components/audio/track/PlayIndicator.vue'
|
||||||
import PlayButton from '~/components/audio/PlayButton.vue'
|
import PlayButton from '~/components/audio/PlayButton.vue'
|
||||||
|
import Button from '~/components/ui/Button.vue'
|
||||||
import { usePlayer } from '~/composables/audio/player'
|
import { usePlayer } from '~/composables/audio/player'
|
||||||
import { useQueue } from '~/composables/audio/queue'
|
import { useQueue } from '~/composables/audio/queue'
|
||||||
import { useStore } from '~/store'
|
import { useStore } from '~/store'
|
||||||
|
@ -90,7 +91,7 @@ const hover = ref(false)
|
||||||
"
|
"
|
||||||
class="ui really tiny basic icon button play-button paused"
|
class="ui really tiny basic icon button play-button paused"
|
||||||
>
|
>
|
||||||
<i class="play icon" />
|
<i class="bi bi-play-fill" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-else-if="
|
v-else-if="
|
||||||
|
@ -100,13 +101,13 @@ const hover = ref(false)
|
||||||
"
|
"
|
||||||
class="ui really tiny basic icon button play-button"
|
class="ui really tiny basic icon button play-button"
|
||||||
>
|
>
|
||||||
<i class="pause icon" />
|
<i class="bi bi-pause-fill" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-else-if="hover"
|
v-else-if="hover"
|
||||||
class="ui really tiny basic icon button play-button"
|
class="ui really tiny basic icon button play-button"
|
||||||
>
|
>
|
||||||
<i class="play icon" />
|
<i class="bi bi-play-fill" />
|
||||||
</button>
|
</button>
|
||||||
<span
|
<span
|
||||||
v-else-if="showPosition"
|
v-else-if="showPosition"
|
||||||
|
@ -209,18 +210,16 @@ const hover = ref(false)
|
||||||
v-if="displayActions"
|
v-if="displayActions"
|
||||||
class="meta right floated column"
|
class="meta right floated column"
|
||||||
>
|
>
|
||||||
<play-button
|
<PlayButton
|
||||||
id="playmenu"
|
id="playmenu"
|
||||||
class="play-button basic icon"
|
|
||||||
:dropdown-only="true"
|
:dropdown-only="true"
|
||||||
:is-playable="track.is_playable"
|
:is-playable="track.is_playable"
|
||||||
:dropdown-icon-classes="[
|
|
||||||
'ellipsis',
|
|
||||||
'vertical',
|
|
||||||
'large really discrete',
|
|
||||||
]"
|
|
||||||
:track="track"
|
:track="track"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
|
@ -24,6 +24,7 @@ const props = defineProps<{
|
||||||
splitIcon?: string // Add this prop for the split button icon
|
splitIcon?: string // Add this prop for the split button icon
|
||||||
splitTitle?: string // Add this prop
|
splitTitle?: string // Add this prop
|
||||||
onSplitClick?: (...args: any[]) => void | Promise<void> // Add click handler for split part
|
onSplitClick?: (...args: any[]) => void | Promise<void> // Add click handler for split part
|
||||||
|
dropdownOnly?: boolean
|
||||||
|
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ onMounted(() => {
|
||||||
<template>
|
<template>
|
||||||
<div v-if="split" class="funkwhale split-button">
|
<div v-if="split" class="funkwhale split-button">
|
||||||
<button
|
<button
|
||||||
|
v-if="!dropdownOnly"
|
||||||
ref="button"
|
ref="button"
|
||||||
v-bind="{
|
v-bind="{
|
||||||
...$attrs,
|
...$attrs,
|
||||||
|
@ -85,7 +87,7 @@ onMounted(() => {
|
||||||
<slot name="main">
|
<slot name="main">
|
||||||
<i v-if="icon && !icon.startsWith('right ')" :class="['bi', icon]" />
|
<i v-if="icon && !icon.startsWith('right ')" :class="['bi', icon]" />
|
||||||
|
|
||||||
<span>
|
<span v-if="!isIconOnly">
|
||||||
<slot />
|
<slot />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ onMounted(() => {
|
||||||
width(props, ['square'])(
|
width(props, ['square'])(
|
||||||
align(props, { alignSelf:'start', alignText:'center' })(
|
align(props, { alignSelf:'start', alignText:'center' })(
|
||||||
)))}"
|
)))}"
|
||||||
class="funkwhale button split-toggle"
|
:class="['funkwhale', 'button', {'split-toggle': !dropdownOnly}]"
|
||||||
:title="splitTitle"
|
:title="splitTitle"
|
||||||
@click="onSplitClick"
|
@click="onSplitClick"
|
||||||
>
|
>
|
||||||
|
|
|
@ -4,8 +4,5 @@
|
||||||
transition: all .2s ease;
|
transition: all .2s ease;
|
||||||
font-size: 0.6rem !important;
|
font-size: 0.6rem !important;
|
||||||
padding: 0.6em !important;
|
padding: 0.6em !important;
|
||||||
span {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue