2021-01-23 00:18:20 +00:00
|
|
|
<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>
|
|
|
|
|
2021-02-03 18:21:47 +00:00
|
|
|
<div
|
|
|
|
class="album-items"
|
|
|
|
:class="{ portrait }"
|
|
|
|
>
|
2021-01-23 00:18:20 +00:00
|
|
|
<div
|
2021-02-05 00:41:53 +00:00
|
|
|
v-for="item in albumItems"
|
2021-01-23 00:18:20 +00:00
|
|
|
:key="item.id"
|
|
|
|
class="item-container"
|
|
|
|
>
|
|
|
|
<a
|
2021-02-03 18:21:47 +00:00
|
|
|
:href="`${path}/${item.path}`"
|
2021-01-23 00:18:20 +00:00
|
|
|
class="item-link"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
<img
|
2021-02-03 18:21:47 +00:00
|
|
|
:src="`${path}/${item.thumbnail}`"
|
2021-02-05 00:41:53 +00:00
|
|
|
:title="item.title"
|
2021-01-23 00:18:20 +00:00
|
|
|
loading="lazy"
|
|
|
|
class="item image"
|
|
|
|
>
|
2021-02-03 18:21:47 +00:00
|
|
|
|
|
|
|
<span
|
2021-02-05 00:41:53 +00:00
|
|
|
v-if="comments && item.title"
|
2021-02-03 18:21:47 +00:00
|
|
|
class="item-comment"
|
2021-02-05 00:41:53 +00:00
|
|
|
>{{ item.title }}</span>
|
2021-01-23 00:18:20 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</teleport>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-02-05 00:41:53 +00:00
|
|
|
function albumItems() {
|
|
|
|
return this.items.map(item => ({
|
|
|
|
...item,
|
|
|
|
title: item.comment || (item.credit && `© ${item.credit}`) || (item.entity && `© ${item.entity.name}`),
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2021-01-23 00:18:20 +00:00
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
items: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: null,
|
|
|
|
},
|
2021-02-03 18:21:47 +00:00
|
|
|
path: {
|
|
|
|
type: String,
|
|
|
|
default: '/media',
|
|
|
|
},
|
|
|
|
portrait: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
comments: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2021-01-23 00:18:20 +00:00
|
|
|
},
|
2021-02-05 00:41:53 +00:00
|
|
|
computed: {
|
|
|
|
albumItems,
|
|
|
|
},
|
2021-01-23 00:18:20 +00:00
|
|
|
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;
|
2021-02-05 01:35:00 +00:00
|
|
|
background: var(--darken-extreme);
|
2021-01-23 00:18:20 +00:00
|
|
|
z-index: 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
.album-header {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.album-title {
|
2021-01-23 22:50:15 +00:00
|
|
|
display: block;
|
2021-01-23 00:18:20 +00:00
|
|
|
flex-grow: 1;
|
|
|
|
align-items: center;
|
2021-01-23 22:50:15 +00:00
|
|
|
padding: 1rem;
|
2021-01-23 00:18:20 +00:00
|
|
|
margin: 0;
|
|
|
|
color: var(--text-light);
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2021-01-23 22:50:15 +00:00
|
|
|
text-align: center;
|
2021-02-03 18:21:47 +00:00
|
|
|
text-transform: capitalize;
|
2021-01-23 00:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.close {
|
2021-01-23 22:03:21 +00:00
|
|
|
width: 1.5rem;
|
|
|
|
height: 1.5rem;
|
2021-01-23 00:18:20 +00:00
|
|
|
padding: 1rem;
|
|
|
|
fill: var(--lighten);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
fill: var(--text-light);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-23 22:03:21 +00:00
|
|
|
.album-items {
|
2021-01-23 00:18:20 +00:00
|
|
|
display: grid;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2021-01-29 14:36:54 +00:00
|
|
|
grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr));
|
2021-01-23 22:03:21 +00:00
|
|
|
grid-gap: 0 1rem;
|
2021-01-23 00:18:20 +00:00
|
|
|
padding: 1rem;
|
2021-01-23 22:09:05 +00:00
|
|
|
margin: auto 0;
|
2021-01-23 22:03:21 +00:00
|
|
|
overflow-y: auto;
|
2021-02-03 18:21:47 +00:00
|
|
|
|
|
|
|
&.portrait {
|
|
|
|
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
|
|
|
|
}
|
2021-01-23 00:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.item-container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
2021-01-23 22:03:21 +00:00
|
|
|
.item-link {
|
2021-02-03 18:21:47 +00:00
|
|
|
position: relative;
|
2021-02-05 01:00:18 +00:00
|
|
|
margin: 0 0 .5rem 0;
|
2021-02-03 18:21:47 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
&:hover .item-comment {
|
|
|
|
transform: translateY(0);
|
|
|
|
}
|
2021-01-23 22:03:21 +00:00
|
|
|
}
|
|
|
|
|
2021-01-23 00:18:20 +00:00
|
|
|
.item {
|
2021-02-04 22:09:52 +00:00
|
|
|
max-width: 100%;
|
|
|
|
max-height: 100%;
|
2021-01-23 00:18:20 +00:00
|
|
|
}
|
|
|
|
|
2021-02-03 18:21:47 +00:00
|
|
|
.item-comment {
|
|
|
|
width: 100%;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: .5rem;
|
|
|
|
color: var(--text-light);
|
|
|
|
background: var(--shadow);
|
|
|
|
font-size: .9rem;
|
|
|
|
text-shadow: 0 0 3px var(--shadow);
|
|
|
|
white-space: normal;
|
|
|
|
line-height: 1.25;
|
|
|
|
transform: translateY(100%);
|
|
|
|
transition: transform .25s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media(max-width: $breakpoint-giga) {
|
2021-02-05 01:00:18 +00:00
|
|
|
.album-items {
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(22.5rem, 1fr));
|
|
|
|
|
|
|
|
.portrait {
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
|
|
|
|
}
|
2021-02-03 18:21:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media(max-width: $breakpoint-mega) {
|
|
|
|
.album-items.portrait {
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-29 14:36:54 +00:00
|
|
|
@media(max-width: $breakpoint-kilo) {
|
|
|
|
.album-items {
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
|
2021-02-05 01:00:18 +00:00
|
|
|
grid-gap: 0 .5rem;
|
|
|
|
padding: .5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.item-link {
|
|
|
|
margin: 0 0 .25rem 0;
|
2021-01-29 14:36:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-24 16:31:32 +00:00
|
|
|
@media(max-width: $breakpoint) {
|
|
|
|
.album-items {
|
2021-02-05 01:00:18 +00:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
|
2021-01-24 16:31:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-24 16:16:55 +00:00
|
|
|
@media(max-width: $breakpoint-micro) {
|
|
|
|
.album-items {
|
2021-02-05 01:00:18 +00:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
|
2021-01-24 16:16:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-23 22:56:24 +00:00
|
|
|
@media(max-width: $breakpoint-pico) {
|
2021-01-23 22:03:21 +00:00
|
|
|
.album-items {
|
2021-01-23 22:56:24 +00:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
|
2021-01-23 22:03:21 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-23 00:18:20 +00:00
|
|
|
</style>
|