1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

Merge pull request #48 from muerwre/task/#47

#47 fixed youtube embed urls
This commit is contained in:
muerwre 2021-03-11 10:06:02 +07:00 committed by GitHub
commit b0a4707ccc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,8 @@ const CommentEmbedBlockUnconnected: FC<Props> = memo(
return (match && match[1]) || '';
}, [block.content]);
const url = useMemo(() => `https://youtube.com/watch?v=${id}`, [id]);
const preview = useMemo(() => getYoutubeThumb(block.content), [block.content]);
useEffect(() => {
@ -47,7 +49,7 @@ const CommentEmbedBlockUnconnected: FC<Props> = memo(
return (
<div className={styles.embed}>
<a href={id[0]} target="_blank" />
<a href={url} target="_blank" />
<div className={styles.preview}>
<div style={{ backgroundImage: `url("${preview}")` }}>