From aac0a6f4b0a5858e404b075492e591d18f95f2e3 Mon Sep 17 00:00:00 2001 From: BrysonXiao <40129652+BrysonXiao@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:00:44 -0800 Subject: [PATCH] Added case to enable videos in articles (#208) --- package.json | 1 + src/components/Article/index.tsx | 5 +++++ src/components/Video/index.tsx | 37 +++++++++++++++++++++++++++----- yarn.lock | 31 ++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e070a4ee..8af17fce 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "react-dom": "16.8.6", "react-emotion": "^9.2.12", "react-helmet": "^5.2.0", + "react-player": "2.14.1", "react-plyr": "^2.1.1", "react-string-replace": "0.4.4", "slugify": "^1.3.3", diff --git a/src/components/Article/index.tsx b/src/components/Article/index.tsx index 2afc668b..e3d3e800 100644 --- a/src/components/Article/index.tsx +++ b/src/components/Article/index.tsx @@ -1,10 +1,12 @@ import * as React from 'react' import { css } from 'react-emotion' import Image, { ImageProps } from '../Image' +import Video, { VideoProps } from '../Video' enum ContentType { Text = 'text', Image = 'image', + Video = 'video', Line = 'line', } @@ -52,6 +54,9 @@ export default class Article extends React.Component { case ContentType.Image: const image = JSON.parse(content.value) as ImageProps return + case ContentType.Video: + const video = JSON.parse(content.value) as VideoProps + return