1
0
Fork 0

Better styles for card

Show large card for large status, but only when there's no poll and media
This commit is contained in:
Lim Chee Aun 2022-12-29 08:57:01 +08:00
parent afb1a75f69
commit a6196f923f
2 changed files with 21 additions and 5 deletions

View file

@ -410,9 +410,14 @@
overflow: hidden;
color: inherit;
align-items: stretch;
background: var(--bg-color);
background-color: var(--bg-color);
max-height: 160px;
}
.status.large .card.link.large {
border-radius: 16px;
flex-direction: column;
max-height: none;
}
.card .image {
width: 35%;
height: auto;
@ -421,6 +426,12 @@
object-fit: cover;
aspect-ratio: 1 / 1;
}
.status.large .card.link.large .image {
aspect-ratio: 1.91 / 1;
width: 100%;
max-height: 50vh;
border-inline-end: 0;
}
.card:hover .image {
animation: position-object 5s ease-in-out 1s 5;
}
@ -471,7 +482,8 @@ a.card {
transition: opacity 0.2s ease-in-out;
}
a.card:hover {
border: 1px solid var(--outline-hover-color);
border: 1px solid var(--link-color);
box-shadow: 0 0 0 2px var(--link-faded-color);
}
.card.video {
max-width: 320px;

View file

@ -436,7 +436,10 @@ function Status({
{!!card &&
(size === 'l' ||
(size === 'm' && !poll && !mediaAttachments.length)) && (
<Card card={card} />
<Card
card={card}
size={!poll && !mediaAttachments.length ? 'l' : 'm'}
/>
)}
</div>
{size === 'l' && (
@ -834,7 +837,7 @@ function Media({ media, showOriginal, onClick = () => {} }) {
}
}
function Card({ card }) {
function Card({ card, size }) {
const {
blurhash,
title,
@ -858,6 +861,7 @@ function Card({ card }) {
*/
const hasText = title || providerName || authorName;
size = size === 'l' ? 'large' : '';
if (hasText && image) {
const domain = new URL(url).hostname.replace(/^www\./, '');
@ -866,7 +870,7 @@ function Card({ card }) {
href={url}
target="_blank"
rel="nofollow noopener noreferrer"
class="card link"
class={`card link ${size}`}
>
<img
class="image"