2018-05-02 01:05:36 +01:00
|
|
|
<div class="status-media {sensitive ? 'status-media-is-sensitive' : ''}"
|
|
|
|
style="grid-template-columns: repeat(auto-fit, minmax({maxMediaWidth}px, 1fr));" >
|
|
|
|
{#each mediaAttachments as media}
|
|
|
|
<Media {media} {uuid} />
|
|
|
|
{/each}
|
2018-02-05 03:56:06 +00:00
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
.status-media {
|
2018-02-10 04:07:48 +00:00
|
|
|
grid-area: media;
|
2018-02-05 03:56:06 +00:00
|
|
|
display: grid;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
justify-items: center;
|
|
|
|
grid-column-gap: 10px;
|
|
|
|
grid-row-gap: 10px;
|
|
|
|
margin: 10px 0;
|
|
|
|
}
|
|
|
|
.status-media.status-media-is-sensitive {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
.status-media {
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
.status-media {
|
|
|
|
max-width: calc(100vw - 40px);
|
|
|
|
}
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
.status-media {
|
|
|
|
max-width: calc(100vw - 20px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import Media from './Media.html'
|
|
|
|
import { DEFAULT_MEDIA_WIDTH } from '../../_static/media'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
2018-05-02 01:05:36 +01:00
|
|
|
maxMediaWidth: ({ mediaAttachments }) => {
|
2018-02-05 03:56:06 +00:00
|
|
|
return Math.max.apply(Math, mediaAttachments.map(media => {
|
2018-04-20 05:38:01 +01:00
|
|
|
return media.meta && media.meta.small && typeof media.meta.small.width === 'number' ? media.meta.small.width : DEFAULT_MEDIA_WIDTH
|
2018-02-05 03:56:06 +00:00
|
|
|
}))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
Media
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|