Skip to content

Commit 77b1a08

Browse files
tweak media attachment styles so mixed video/image appear side by side
1 parent 400f832 commit 77b1a08

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "embedodon",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "A simple client-side script to render an Activity Stream (like from Mastodon)",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/Embedodon.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,22 @@ export class Embedodon {
4747
.media {
4848
display: flex;
4949
flex-flow: row nowrap;
50-
justify-content: space-around;
50+
justify-content: center;
5151
align-items: center;
5252
gap: 0.5rem;
5353
}
54-
.media img,
55-
.media video {
56-
max-width: 100%;
57-
}
58-
.media a {
59-
display: inline-block;
54+
.media > a {
55+
flex: 1 1;
56+
min-width: 0;
57+
display: block;
58+
position: relative;
6059
}
61-
.media a:hover {
60+
.media > a:hover {
6261
outline: solid 2px var(--link);
6362
}
63+
.media > a > * {
64+
width: 100%;
65+
}
6466
6567
footer {
6668
text-align: end;
@@ -167,11 +169,13 @@ export class Embedodon {
167169
`
168170
} else if (attachment.type === 'gifv' && attachment.preview_url && attachment.url) {
169171
return html`
170-
<video autoplay loop playsinline
171-
part="video"
172-
poster="${attachment.preview_url}"
173-
src="${attachment.url}"
174-
>
172+
<a href="${attachment.url}">
173+
<video autoplay loop playsinline
174+
part="video"
175+
poster="${attachment.preview_url}"
176+
src="${attachment.url}"
177+
></video>
178+
</a>
175179
`
176180
} else {
177181
return ''

0 commit comments

Comments
 (0)