2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2024-04-04 22:20:42 +00:00
|
|
|
<span class="flex w-[64px] border border-solid border-white/20 rounded-md overflow-hidden mt-[0.5rem] md:mt-0">
|
2022-04-15 14:24:30 +00:00
|
|
|
<label
|
2022-10-25 17:29:56 +00:00
|
|
|
v-koel-tooltip
|
2022-04-29 22:06:13 +00:00
|
|
|
:class="{ active: value === 'thumbnails' }"
|
2022-04-15 14:24:30 +00:00
|
|
|
class="thumbnails"
|
2022-05-03 16:51:59 +00:00
|
|
|
data-testid="view-mode-thumbnail"
|
2022-04-29 22:06:13 +00:00
|
|
|
title="View as thumbnails"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
2022-04-29 22:06:13 +00:00
|
|
|
<input v-model="value" class="hidden" name="view-mode" type="radio" value="thumbnails">
|
2023-11-10 13:16:06 +00:00
|
|
|
<Icon :icon="faThumbnailsHehe" />
|
2022-04-15 14:24:30 +00:00
|
|
|
<span class="hidden">View as thumbnails</span>
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<label
|
2022-10-25 17:29:56 +00:00
|
|
|
v-koel-tooltip
|
2022-04-29 22:06:13 +00:00
|
|
|
:class="{ active: value === 'list' }"
|
2022-04-15 14:24:30 +00:00
|
|
|
class="list"
|
2022-05-03 16:51:59 +00:00
|
|
|
data-testid="view-mode-list"
|
2022-04-29 22:06:13 +00:00
|
|
|
title="View as list"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
2022-04-29 22:06:13 +00:00
|
|
|
<input v-model="value" class="hidden" name="view-mode" type="radio" value="list">
|
2023-11-10 13:16:06 +00:00
|
|
|
<Icon :icon="faList" />
|
2022-04-15 14:24:30 +00:00
|
|
|
<span class="hidden">View as list</span>
|
|
|
|
</label>
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-07-15 07:23:55 +00:00
|
|
|
import { faMicrosoft as faThumbnailsHehe } from '@fortawesome/free-brands-svg-icons'
|
|
|
|
import { faList } from '@fortawesome/free-solid-svg-icons'
|
2022-04-30 08:11:01 +00:00
|
|
|
import { computed } from 'vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-29 21:36:45 +00:00
|
|
|
const props = withDefaults(defineProps<{ modelValue?: ArtistAlbumViewMode }>(), { modelValue: 'thumbnails' })
|
2022-11-13 15:18:24 +00:00
|
|
|
|
|
|
|
const emit = defineEmits<{ (e: 'update:modelValue', value: ArtistAlbumViewMode): void }>()
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-29 22:06:13 +00:00
|
|
|
const value = computed({
|
2022-05-29 21:36:45 +00:00
|
|
|
get: () => props.modelValue,
|
|
|
|
set: value => emit('update:modelValue', value)
|
2022-04-29 22:06:13 +00:00
|
|
|
})
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
2024-04-04 20:13:35 +00:00
|
|
|
<style lang="postcss" scoped>
|
2024-04-04 22:20:42 +00:00
|
|
|
label {
|
|
|
|
@apply w-1/2 flex items-center justify-center h-[2rem] mb-0 cursor-pointer;
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
&.active {
|
|
|
|
@apply bg-k-text-primary text-k-bg-primary;
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|