koel/resources/assets/js/components/ui/ExtraDrawerTabHeader.vue

70 lines
1.8 KiB
Vue
Raw Normal View History

2022-10-13 15:18:47 +00:00
<template>
<button
id="extraTabLyrics"
v-koel-tooltip.left
2022-10-13 15:18:47 +00:00
:class="{ active: value === 'Lyrics' }"
title="Lyrics"
type="button"
@click.prevent="toggleTab('Lyrics')"
>
<icon :icon="faFeather" fixed-width />
2022-10-13 15:18:47 +00:00
</button>
<button
id="extraTabArtist"
v-koel-tooltip.left
2022-10-13 15:18:47 +00:00
:class="{ active: value === 'Artist' }"
title="Artist information"
type="button"
@click.prevent="toggleTab('Artist')"
>
2022-12-02 16:17:37 +00:00
<icon :icon="faMicrophone" fixed-width />
2022-10-13 15:18:47 +00:00
</button>
<button
id="extraTabAlbum"
v-koel-tooltip.left
2022-10-13 15:18:47 +00:00
:class="{ active: value === 'Album' }"
title="Album information"
type="button"
@click.prevent="toggleTab('Album')"
>
2022-12-02 16:17:37 +00:00
<icon :icon="faCompactDisc" fixed-width />
2022-10-13 15:18:47 +00:00
</button>
<button
v-if="useYouTube"
id="extraTabYouTube"
2022-12-02 16:17:37 +00:00
v-koel-tooltip.left
2022-10-13 15:18:47 +00:00
:class="{ active: value === 'YouTube' }"
title="Related YouTube videos"
type="button"
@click.prevent="toggleTab('YouTube')"
>
2022-12-02 16:17:37 +00:00
<icon :icon="faYoutube" fixed-width />
2022-10-13 15:18:47 +00:00
</button>
</template>
<script lang="ts" setup>
import { faCompactDisc, faFeather, faMicrophone } from '@fortawesome/free-solid-svg-icons'
2022-10-13 15:18:47 +00:00
import { faYoutube } from '@fortawesome/free-brands-svg-icons'
import { computed } from 'vue'
import { useThirdPartyServices } from '@/composables'
2022-12-02 16:17:37 +00:00
const props = withDefaults(defineProps<{ modelValue?: ExtraPanelTab | null }>(), {
modelValue: null
})
2022-10-13 15:18:47 +00:00
2022-12-02 16:17:37 +00:00
const emit = defineEmits<{ (e: 'update:modelValue', value: ExtraPanelTab | null): void }>()
2022-10-13 15:18:47 +00:00
const { useYouTube } = useThirdPartyServices()
const value = computed({
get: () => props.modelValue,
set: value => emit('update:modelValue', value)
})
2022-12-02 16:17:37 +00:00
const toggleTab = (tab: ExtraPanelTab) => (value.value = value.value === tab ? null : tab)
2022-10-13 15:18:47 +00:00
</script>
<style scoped>
</style>