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

fixed youtube block

This commit is contained in:
Fedor Katurov 2019-11-26 11:07:40 +07:00
parent 93afa626db
commit b87487ed1f
7 changed files with 34 additions and 7 deletions

View file

@ -0,0 +1,23 @@
import React, { FC, memo } from 'react';
import { ICommentBlock } from '~/constants/comment';
import styles from './styles.scss';
interface IProps {
block: ICommentBlock;
}
const CommentEmbedBlock: FC<IProps> = memo(({ block }) => {
const link = block.content.match(
/(https?:\/\/(www\.)?(youtube\.com|youtu\.be)\/(watch)?(\?v=)?[\w\-]+)/gi
);
return (
<div className={styles.text}>
<a href={link[0]} target="_blank">
{link[0]}
</a>
</div>
);
});
export { CommentEmbedBlock };

View file

@ -0,0 +1,3 @@
.text {
padding: 0 $gap;
}

View file

@ -1,5 +1,5 @@
.text {
padding: $gap;
padding: 0 $gap;
font-weight: 300;
font: $font_16_medium;
line-height: 20px;