mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-04-02 12:01:36 +02:00
Special styling for portrait media
This commit is contained in:
parent
5598059715
commit
adfe660cc8
2 changed files with 12 additions and 0 deletions
src/components
|
@ -24,6 +24,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
const width = showOriginal ? original?.width : small?.width;
|
const width = showOriginal ? original?.width : small?.width;
|
||||||
const height = showOriginal ? original?.height : small?.height;
|
const height = showOriginal ? original?.height : small?.height;
|
||||||
const mediaURL = showOriginal ? url : previewUrl;
|
const mediaURL = showOriginal ? url : previewUrl;
|
||||||
|
const orientation = width >= height ? 'landscape' : 'portrait';
|
||||||
|
|
||||||
const rgbAverageColor = blurhash ? getBlurHashAverageColor(blurhash) : null;
|
const rgbAverageColor = blurhash ? getBlurHashAverageColor(blurhash) : null;
|
||||||
|
|
||||||
|
@ -97,6 +98,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
alt={description}
|
alt={description}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
data-orientation={orientation}
|
||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
|
@ -112,6 +114,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
alt={description}
|
alt={description}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
data-orientation={orientation}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
|
@ -140,6 +143,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
poster="${previewUrl}"
|
poster="${previewUrl}"
|
||||||
width="${width}"
|
width="${width}"
|
||||||
height="${height}"
|
height="${height}"
|
||||||
|
data-orientation="${orientation}"
|
||||||
preload="auto"
|
preload="auto"
|
||||||
autoplay
|
autoplay
|
||||||
muted="${isGIF}"
|
muted="${isGIF}"
|
||||||
|
@ -209,6 +213,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
poster={previewUrl}
|
poster={previewUrl}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
data-orientation={orientation}
|
||||||
preload="auto"
|
preload="auto"
|
||||||
// controls
|
// controls
|
||||||
playsinline
|
playsinline
|
||||||
|
@ -222,6 +227,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
alt={description}
|
alt={description}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
data-orientation={orientation}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
<div class="media-play">
|
<div class="media-play">
|
||||||
|
@ -247,6 +253,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
alt={description}
|
alt={description}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
|
data-orientation={orientation}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -477,6 +477,11 @@
|
||||||
height: auto;
|
height: auto;
|
||||||
max-height: 160px;
|
max-height: 160px;
|
||||||
}
|
}
|
||||||
|
.status .media-container.media-eq1:has([data-orientation='portrait']) {
|
||||||
|
width: 85%;
|
||||||
|
min-width: 160px;
|
||||||
|
max-height: 200px;
|
||||||
|
}
|
||||||
.status .media-container.media-gt2 {
|
.status .media-container.media-gt2 {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue