traxxx/assets/components/album/album.vue

137 lines
2.0 KiB
Vue

<template>
<teleport to="body">
<div class="album">
<div class="album-header">
<h3 class="album-title">{{ title }}</h3>
<Icon
icon="cross2"
class="close"
@click.native="$emit('close')"
/>
</div>
<div class="album-items">
<div
v-for="item in items"
:key="item.id"
class="item-container"
>
<a
:href="`/media/${item.path}`"
class="item-link"
target="_blank"
>
<img
:src="`/media/${item.thumbnail}`"
loading="lazy"
class="item image"
>
</a>
</div>
</div>
</div>
</teleport>
</template>
<script>
export default {
props: {
items: {
type: Array,
default: () => [],
},
title: {
type: String,
default: null,
},
},
emits: ['close'],
};
</script>
<style lang="scss" scoped>
@import 'breakpoints';
.album {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
position: fixed;
top: 0;
left: 0;
background: var(--shadow-extreme);
z-index: 10;
}
.album-header {
display: flex;
justify-content: space-between;
flex-shrink: 0;
}
.album-title {
display: flex;
flex-grow: 1;
align-items: center;
justify-content: center;
padding: .5rem 1rem;
margin: 0;
color: var(--text-light);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.close {
width: 1.5rem;
height: 1.5rem;
padding: 1rem;
fill: var(--lighten);
&:hover {
cursor: pointer;
fill: var(--text-light);
}
}
.album-items {
display: grid;
flex-grow: 1;
align-items: center;
justify-content: center;
grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
grid-gap: 0 1rem;
padding: 1rem;
overflow-y: auto;
}
.item-container {
display: flex;
align-items: center;
justify-content: center;
}
.item-link {
height: 100%;
}
.item {
width: 100%;
margin: 0 0 1rem 0;
}
@media(max-width: $breakpoint) {
.album-items {
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}
}
@media(max-width: $breakpoint-nano) {
.album-items {
grid-template-columns: repeat(auto-fill, 1fr);
}
}
</style>