2019-01-27 02:45:03 +11:00
|
|
|
<template>
|
2019-04-11 04:48:42 +10:00
|
|
|
<div ref="galleryContainer" style="width: 100%;">
|
|
|
|
<div class="gallery-row" v-for="row in rows" :style="rowHeight(row.length)" :class="{ 'contain-fit': useContainFit, 'cover-fit': !useContainFit }">
|
2019-01-27 02:45:03 +11:00
|
|
|
<attachment
|
|
|
|
v-for="attachment in row"
|
2019-04-11 04:48:42 +10:00
|
|
|
:setMedia="setMedia"
|
2019-01-27 02:45:03 +11:00
|
|
|
:nsfw="nsfw"
|
|
|
|
:attachment="attachment"
|
2019-04-11 04:48:42 +10:00
|
|
|
:allowPlay="false"
|
|
|
|
:key="attachment.id"
|
2019-01-27 02:45:03 +11:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src='./gallery.js'></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
|
|
|
.gallery-row {
|
|
|
|
height: 200px;
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
align-content: stretch;
|
|
|
|
flex-grow: 1;
|
|
|
|
margin-top: 0.5em;
|
|
|
|
|
|
|
|
.attachments, .attachment {
|
|
|
|
margin: 0 0.5em 0 0;
|
|
|
|
flex-grow: 1;
|
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
2019-01-31 06:41:07 +11:00
|
|
|
// to make failed images a bit more noticeable on chromium
|
|
|
|
min-width: 2em;
|
2019-03-03 03:35:38 +11:00
|
|
|
&:last-child {
|
|
|
|
margin: 0;
|
|
|
|
}
|
2019-01-27 02:45:03 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
.image-attachment {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.video-container {
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.contain-fit {
|
|
|
|
img, video {
|
|
|
|
object-fit: contain;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.cover-fit {
|
|
|
|
img, video {
|
|
|
|
object-fit: cover;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|