File tree Expand file tree Collapse file tree 3 files changed +21
-19
lines changed Expand file tree Collapse file tree 3 files changed +21
-19
lines changed Original file line number Diff line number Diff line change 69
69
"react-i18next" : " ^12.1.4" ,
70
70
"react-icons" : " ^4.3.1" ,
71
71
"react-instantsearch-dom" : " ^6.32.0" ,
72
+ "react-lite-youtube-embed" : " ^2.4.0" ,
72
73
"react-select" : " ^4.3.0" ,
73
74
"recharts" : " ^2.1.9" ,
74
75
"styled-system" : " ^5.1.5" ,
Original file line number Diff line number Diff line change 1
1
import React from "react"
2
- import { AspectRatio } from "@chakra-ui/react"
2
+ import { Box } from "@chakra-ui/react"
3
+ import LiteYouTubeEmbed from "react-lite-youtube-embed"
4
+ import "react-lite-youtube-embed/dist/LiteYouTubeEmbed.css"
3
5
4
6
/**
5
7
* @param {id } ID of the YouTube video
@@ -11,32 +13,26 @@ import { AspectRatio } from "@chakra-ui/react"
11
13
* @returns Embedded YouTube video component
12
14
*/
13
15
14
- export interface IProps {
16
+ type YouTubeProps = {
15
17
id : string
16
18
start ?: string
17
19
title ?: string
18
20
}
19
21
20
- const YouTube : React . FC < IProps > = ( { id, start = "0" , title = "YouTube" } ) => {
21
- const startQuery = parseInt ( start ) > 0 ? `?start=${ start } ` : ""
22
- const baseUrl = "https://www.youtube.com/embed/"
23
- const src = baseUrl + id + startQuery
22
+ const YouTube = ( { id, start = "0" , title = "YouTube" } : YouTubeProps ) => {
23
+ const params = new URLSearchParams ( )
24
+ ; + start > 0 && params . set ( "start" , start )
24
25
return (
25
- < AspectRatio as = "figure" maxW = "560px" ratio = { 16 / 9 } my = { 8 } >
26
- < iframe
27
- src = { src }
28
- frameBorder = "0"
26
+ < Box as = "figure" maxW = { 560 } my = { 8 } >
27
+ < LiteYouTubeEmbed
28
+ aspectHeight = { 9 }
29
+ aspectWidth = { 16 }
30
+ id = { id }
29
31
title = { title }
30
- allow = "
31
- accelerometer;
32
- autoplay;
33
- clipboard-write;
34
- encrypted-media;
35
- gyroscope;
36
- picture-in-picture"
37
- allowFullScreen
32
+ params = { params . toString ( ) }
33
+ noCookie
38
34
/>
39
- </ AspectRatio >
35
+ </ Box >
40
36
)
41
37
}
42
38
Original file line number Diff line number Diff line change @@ -15634,6 +15634,11 @@ react-lifecycles-compat@^3.0.4:
15634
15634
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
15635
15635
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
15636
15636
15637
+ react-lite-youtube-embed@^2.4.0:
15638
+ version "2.4.0"
15639
+ resolved "https://registry.yarnpkg.com/react-lite-youtube-embed/-/react-lite-youtube-embed-2.4.0.tgz#1f56a12be1061d50431444d52d836bd09a1283a2"
15640
+ integrity sha512-Xo6cM1zPlROvvM97JkqQIoXstlQDaC4+DawmM7BB7Hh1cXrkBHEGq1iJlQxBTUWAUklmpcC7ph7qg7CztXtABQ==
15641
+
15637
15642
react-refresh@^0.11.0:
15638
15643
version "0.11.0"
15639
15644
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
You can’t perform that action at this time.
0 commit comments