Allow show more figcaption
This commit is contained in:
parent
c1da6b8767
commit
01c90150a8
2 changed files with 19 additions and 8 deletions
|
@ -48,6 +48,8 @@ const AltBadge = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const MEDIA_CAPTION_LIMIT = 140;
|
||||||
|
|
||||||
function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
const {
|
const {
|
||||||
blurhash,
|
blurhash,
|
||||||
|
@ -371,11 +373,17 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
</Parent>
|
</Parent>
|
||||||
{showInlineDesc && (
|
{showInlineDesc && (
|
||||||
<figcaption
|
<figcaption
|
||||||
|
class={`media-caption media-caption-${
|
||||||
|
description.length <= MEDIA_CAPTION_LIMIT ? 'short' : 'long'
|
||||||
|
}`}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
states.showMediaAlt = description;
|
states.showMediaAlt = description;
|
||||||
}}
|
}}
|
||||||
|
title={
|
||||||
|
description.length > MEDIA_CAPTION_LIMIT ? description : undefined
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{description}
|
{description}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
|
|
|
@ -714,16 +714,19 @@
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
color: var(--text-insignificant-color);
|
color: var(--text-insignificant-color);
|
||||||
|
line-height: 1.2;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.media-caption-long {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
display: box;
|
display: box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
box-orient: vertical;
|
box-orient: vertical;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 3;
|
||||||
line-clamp: 2;
|
line-clamp: 3;
|
||||||
line-height: 1.2;
|
}
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue