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

#47 fixed youtube embed urls

This commit is contained in:
Fedor Katurov 2021-03-11 10:03:02 +07:00
parent 054f3041c4
commit 69530a8408

View file

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