feat: GIF and Video embed support

This commit is contained in:
Paul Makles 2022-05-19 13:34:19 +01:00
parent e74c3a5f80
commit 744afe2f6a

View file

@ -89,6 +89,20 @@ export default function Embed({ embed }: Props) {
}
const { width, height } = calculateSize(mw, mh);
if (embed.type === "Website" && embed.special?.type === "GIF") {
return (
<EmbedMedia
embed={embed}
width={
height *
((embed.image?.width ?? 0) /
(embed.image?.height ?? 0))
}
height={height}
/>
);
}
return (
<div
className={classNames(styles.embed, styles.website)}
@ -181,6 +195,18 @@ export default function Embed({ embed }: Props) {
/>
);
}
case "Video": {
return (
<video
className={classNames(styles.embed, styles.image)}
style={calculateSize(embed.width, embed.height)}
src={client.proxyFile(embed.url)}
frameBorder="0"
loading="lazy"
controls
/>
);
}
default:
return null;
}