elk/components/status/StatusMedia.vue

43 lines
943 B
Vue
Raw Normal View History

2022-11-14 05:56:48 +03:00
<script setup lang="ts">
2022-11-14 06:33:09 +03:00
import type { Status } from 'masto'
2022-11-14 05:56:48 +03:00
2022-11-14 06:33:09 +03:00
const { status } = defineProps<{
status: Status
2022-11-14 05:56:48 +03:00
}>()
</script>
<template>
2022-11-14 06:33:09 +03:00
<div class="status-media-container" :class="`status-media-container-${status.mediaAttachments.length}`">
<template v-for="attachment of status.mediaAttachments" :key="attachment.id">
<StatusAttachment :attachment="attachment" class="w-full h-full" />
</template>
</div>
2022-11-14 05:56:48 +03:00
</template>
2022-11-14 06:33:09 +03:00
<style lang="postcss">
.status-media-container {
--at-apply: gap-0.5;
width: 100%;
overflow: hidden;
}
.status-media-container-1 {
display: grid;
grid-template-columns: 1fr;
}
.status-media-container-2 {
display: grid;
grid-template-columns: 1fr 1fr;
aspect-ratio: 2/1;
}
.status-media-container-3 {
display: grid;
aspect-ratio: 16/9;
grid-template-columns: 1fr 1fr;
}
.status-media-container-4 {
display: grid;
aspect-ratio: 16/9;
grid-template-columns: 1fr 1fr;
}
</style>