2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
|
|
|
<span class="view-modes">
|
|
|
|
<label
|
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-05-12 13:21:14 +00:00
|
|
|
<i class="fa fa-th-large"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
<span class="hidden">View as thumbnails</span>
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<label
|
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-05-12 13:21:14 +00:00
|
|
|
<i class="fa fa-list"/>
|
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-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' })
|
|
|
|
const emit = defineEmits(['update:modelValue'])
|
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%;
|
|
|
|
text-align: center;
|
|
|
|
line-height: 2rem;
|
|
|
|
font-size: 1rem;
|
|
|
|
margin-bottom: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
background: var(--color-text-primary);
|
|
|
|
color: var(--color-bg-primary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media only screen and(max-width: 768px) {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|