mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 16:58:47 +01:00
Show large card for content with text-weight=1
Also finally replace the hacky CSS with something more legit
This commit is contained in:
parent
c2e9dc0efe
commit
c13cab51a9
3 changed files with 13 additions and 10 deletions
|
@ -618,10 +618,7 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
|
|||
font-size: calc(100% + 25% * max(2 - var(--content-text-weight), 0));
|
||||
}
|
||||
.status-carousel
|
||||
.content-container:is(
|
||||
[style*='content-text-weight:1'],
|
||||
[style*='content-text-weight: 1']
|
||||
)
|
||||
.content-container[data-content-text-weight='1']
|
||||
.media-container.media-eq1 {
|
||||
/* LOL, this is madness, reading a value from the style attribute */
|
||||
height: auto;
|
||||
|
|
|
@ -590,7 +590,8 @@ body:has(#modal-container .carousel) .status .media img:hover {
|
|||
max-width: 480px;
|
||||
/* max-height: 160px; */
|
||||
}
|
||||
.status.large .card.large {
|
||||
.status.large .card.large,
|
||||
.status-carousel .content-container[data-content-text-weight='1'] .card.large {
|
||||
border-radius: 16px;
|
||||
flex-direction: column;
|
||||
max-height: none;
|
||||
|
@ -618,7 +619,11 @@ body:has(#modal-container .carousel) .status .media img:hover {
|
|||
.status.large .card .card-image {
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
.status.large .card.large .card-image {
|
||||
.status.large .card.large .card-image,
|
||||
.status-carousel
|
||||
.content-container[data-content-text-weight='1']
|
||||
.card.large
|
||||
.card-image {
|
||||
flex-grow: 1;
|
||||
aspect-ratio: 1.91 / 1;
|
||||
width: 100%;
|
||||
|
|
|
@ -208,6 +208,9 @@ function Status({
|
|||
|
||||
const unauthInteractionErrorMessage = `Sorry, your current logged-in instance can't interact with this status from another instance.`;
|
||||
|
||||
const textWeight = () =>
|
||||
Math.round((spoilerText.length + htmlContentLength(content)) / 140) || 1;
|
||||
|
||||
return (
|
||||
<article
|
||||
ref={statusRef}
|
||||
|
@ -326,12 +329,10 @@ function Status({
|
|||
class={`content-container ${
|
||||
spoilerText || sensitive ? 'has-spoiler' : ''
|
||||
} ${showSpoiler ? 'show-spoiler' : ''}`}
|
||||
data-content-text-weight={contentTextWeight ? textWeight() : null}
|
||||
style={
|
||||
(size === 'l' || contentTextWeight) && {
|
||||
'--content-text-weight':
|
||||
Math.round(
|
||||
(spoilerText.length + htmlContentLength(content)) / 140,
|
||||
) || 1,
|
||||
'--content-text-weight': textWeight(),
|
||||
}
|
||||
}
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue