fix: improve style of "large inline" media (#1428)
This commit is contained in:
parent
b7c97118e2
commit
88ab0b929c
|
@ -1,5 +1,5 @@
|
||||||
<div class="non-autoplay-gifv {$largeInlineMedia ? '' : 'non-autoplay-gifv-fixed-size'}"
|
<div class="non-autoplay-gifv {$largeInlineMedia ? '' : 'non-autoplay-gifv-fixed-size'}"
|
||||||
style="width: {width}px; height: {height}px;"
|
{style}
|
||||||
on:mouseover="onMouseOver(event)"
|
on:mouseover="onMouseOver(event)"
|
||||||
ref:node
|
ref:node
|
||||||
>
|
>
|
||||||
|
@ -70,6 +70,11 @@
|
||||||
oneTransparentPixel: ONE_TRANSPARENT_PIXEL,
|
oneTransparentPixel: ONE_TRANSPARENT_PIXEL,
|
||||||
focus: undefined
|
focus: undefined
|
||||||
}),
|
}),
|
||||||
|
computed: {
|
||||||
|
style: ({ useWidthHeight, width, height }) => (
|
||||||
|
useWidthHeight ? `width: ${width}px; height: ${height}px;` : ''
|
||||||
|
)
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
PlayVideoIcon,
|
PlayVideoIcon,
|
||||||
LazyImage,
|
LazyImage,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
type="button"
|
type="button"
|
||||||
class="inline-media play-video-button focus-after {$largeInlineMedia ? '' : 'fixed-size'} {type === 'audio' ? 'play-audio-button' : ''}"
|
class="inline-media play-video-button focus-after {$largeInlineMedia ? '' : 'fixed-size'} {type === 'audio' ? 'play-audio-button' : ''}"
|
||||||
aria-label="Play video: {description}"
|
aria-label="Play video: {description}"
|
||||||
style="width: {inlineWidth}px; height: {inlineHeight}px;">
|
style={inlineMediaStyle}>
|
||||||
<PlayVideoIcon />
|
<PlayVideoIcon />
|
||||||
{#if type === 'video'}
|
{#if type === 'video'}
|
||||||
<LazyImage
|
<LazyImage
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
aria-label="Show image: {description}"
|
aria-label="Show image: {description}"
|
||||||
title={description}
|
title={description}
|
||||||
on:mouseover="set({mouseover: event})"
|
on:mouseover="set({mouseover: event})"
|
||||||
style="width: {inlineWidth}px; height: {inlineHeight}px;">
|
style={inlineMediaStyle}>
|
||||||
{#if type === 'gifv' && $autoplayGifs && !blurhash}
|
{#if type === 'gifv' && $autoplayGifs && !blurhash}
|
||||||
<AutoplayVideo
|
<AutoplayVideo
|
||||||
ariaLabel="Animated GIF: {description}"
|
ariaLabel="Animated GIF: {description}"
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
{blurhash}
|
{blurhash}
|
||||||
src={url}
|
src={url}
|
||||||
staticSrc={previewUrl}
|
staticSrc={previewUrl}
|
||||||
|
useWidthHeight={!blurhash}
|
||||||
width={inlineWidth}
|
width={inlineWidth}
|
||||||
height={inlineHeight}
|
height={inlineHeight}
|
||||||
playing={mouseover}
|
playing={mouseover}
|
||||||
|
@ -141,7 +142,14 @@ export default {
|
||||||
},
|
},
|
||||||
blurhash: ({ blurhashToUse, showAsSensitive }) => showAsSensitive && blurhashToUse,
|
blurhash: ({ blurhashToUse, showAsSensitive }) => showAsSensitive && blurhashToUse,
|
||||||
url: ({ media }) => media.url,
|
url: ({ media }) => media.url,
|
||||||
type: ({ media }) => media.type
|
type: ({ media }) => media.type,
|
||||||
|
inlineMediaStyle: ({ type, inlineWidth, inlineHeight, blurhash, $largeInlineMedia }) => {
|
||||||
|
if ((type === 'audio') || (blurhash && $largeInlineMedia)) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
|
return `width: ${inlineWidth}px; height: ${inlineHeight}px;`
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClick () {
|
onClick () {
|
||||||
|
|
|
@ -38,6 +38,17 @@
|
||||||
background-color: blue;
|
background-color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-media.not-grouped-images > :global(.inline-media) {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-media.not-grouped-images :global(.inline-media img),
|
||||||
|
.status-media.not-grouped-images :global(.inline-media .lazy-image) {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.status-media.status-media-is-sensitive {
|
.status-media.status-media-is-sensitive {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -54,7 +65,7 @@
|
||||||
sensitive && 'status-media-is-sensitive',
|
sensitive && 'status-media-is-sensitive',
|
||||||
oddCols && 'odd-cols',
|
oddCols && 'odd-cols',
|
||||||
twoCols && 'two-cols',
|
twoCols && 'two-cols',
|
||||||
!$largeInlineMedia && 'grouped-images'
|
$largeInlineMedia ? 'not-grouped-images' : 'grouped-images'
|
||||||
),
|
),
|
||||||
showAsSensitive: ({ sensitive, sensitiveShown }) => {
|
showAsSensitive: ({ sensitive, sensitiveShown }) => {
|
||||||
return sensitive ? !sensitiveShown : false
|
return sensitive ? !sensitiveShown : false
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
}
|
}
|
||||||
.status-sensitive-media-container.status-sensitive-media-hidden.not-grouped-images {
|
.status-sensitive-media-container.status-sensitive-media-hidden.not-grouped-images {
|
||||||
height: 200px;
|
height: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-sensitive-media-container .status-sensitive-media-warning {
|
.status-sensitive-media-container .status-sensitive-media-warning {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export const DEFAULT_MEDIA_WIDTH = 300
|
export const DEFAULT_MEDIA_WIDTH = 300
|
||||||
export const DEFAULT_MEDIA_HEIGHT = 200
|
export const DEFAULT_MEDIA_HEIGHT = 250
|
||||||
|
|
||||||
export const ONE_TRANSPARENT_PIXEL =
|
export const ONE_TRANSPARENT_PIXEL =
|
||||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
||||||
|
|
Loading…
Reference in New Issue