pinafore/routes/_components/dialog/components/ImageDialog.html

62 lines
1.2 KiB
HTML
Raw Normal View History

<ModalDialog
{id}
{label}
background="var(--muted-modal-bg)"
muted="true"
className="image-modal-dialog"
2018-04-01 01:46:44 +00:00
>
{#if type === 'gifv'}
<video
class="image-modal-dialog-autoplay-video"
aria-label="Animated GIF: {description || ''}"
style="background-image: url({poster}); "
{width}
{height}
{src}
autoplay
muted
loop
webkit-playsinline
playsinline
/>
{:else}
<img
{src}
{width}
{height}
alt={description || ''}
title={description || ''}
/>
{/if}
</ModalDialog>
<style>
2018-04-01 01:46:44 +00:00
:global(.image-modal-dialog img, .image-modal-dialog video) {
object-fit: contain;
max-width: calc(100vw - 20px);
2018-02-23 04:04:19 +00:00
max-height: calc(100% - 20px);
overflow: hidden;
}
.image-modal-dialog-autoplay-video {
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
</style>
<script>
2018-02-05 17:43:45 +00:00
import ModalDialog from './ModalDialog.html'
import { show } from '../helpers/showDialog'
import { oncreate } from '../helpers/onCreateDialog'
export default {
oncreate,
components: {
ModalDialog
},
methods: {
show
}
}
</script>