traxxx/assets/components/album/album.vue

127 lines
1.9 KiB
Vue
Raw Normal View History

<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">
<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;
overflow-y: auto;
}
.album-header {
display: flex;
justify-content: space-between;
flex-shrink: 0;
overflow: hidden;
}
.album-title {
display: flex;
flex-grow: 1;
align-items: center;
justify-content: center;
padding: 1rem;
margin: 0;
color: var(--text-light);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.close {
width: 2rem;
height: 2rem;
padding: 1rem;
fill: var(--lighten);
&:hover {
cursor: pointer;
fill: var(--text-light);
}
}
.album {
display: grid;
flex-grow: 1;
align-items: center;
justify-content: center;
grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
grid-gap: 1rem;
padding: 1rem;
}
.item-container {
display: flex;
align-items: center;
justify-content: center;
}
.item {
height: 15rem;
}
@media(max-width: $breakpoint) {
.album {
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}
}
</style>