CompactToot: added preview cards
This commit is contained in:
parent
df19e54d9b
commit
e79480acc0
2 changed files with 13 additions and 4 deletions
|
@ -197,10 +197,17 @@ function TootAuthorGroup(props: { status: mastodon.v1.Status; now: Date }) {
|
|||
);
|
||||
}
|
||||
|
||||
function TootPreviewCard(props: { src: mastodon.v1.PreviewCard }) {
|
||||
export function TootPreviewCard(props: {
|
||||
src: mastodon.v1.PreviewCard;
|
||||
alwaysCompact?: boolean;
|
||||
}) {
|
||||
let root: HTMLAnchorElement;
|
||||
|
||||
createEffect(() => {
|
||||
if (props.alwaysCompact) {
|
||||
root.classList.add(tootStyle.compact);
|
||||
return;
|
||||
}
|
||||
if (!props.src.width) return;
|
||||
const width = root.getBoundingClientRect().width;
|
||||
if (width > props.src.width) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue