2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
|
|
|
<span class="view-modes">
|
|
|
|
<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">
|
2022-12-02 16:17:37 +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">
|
2022-12-02 16:17:37 +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>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.view-modes {
|
|
|
|
display: flex;
|
|
|
|
width: 64px;
|
|
|
|
border: 1px solid rgba(255, 255, 255, .2);
|
|
|
|
border-radius: 5px;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
label {
|
|
|
|
width: 50%;
|
2022-07-15 07:23:55 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
height: 2rem;
|
2022-04-15 14:24:30 +00:00
|
|
|
margin-bottom: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
background: var(--color-text-primary);
|
|
|
|
color: var(--color-bg-primary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-09 08:32:22 +00:00
|
|
|
@media only screen and (max-width: 768px) {
|
2022-04-15 14:24:30 +00:00
|
|
|
margin-top: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|