From 7da327c1312dc3e18d1bdebf9cc18038a8d66c5e Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Sun, 27 Aug 2023 23:04:57 +0300 Subject: [PATCH] Embed youtube video --- .../src/components/Common/EmbedYoutube.tsx | 31 +++++++++++++ .../src/components/Help/HelpRSLang.tsx | 44 ++++++++++++++----- rsconcept/frontend/src/hooks/useWindowSize.ts | 31 +++++++++++++ rsconcept/frontend/src/utils/constants.ts | 4 ++ 4 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 rsconcept/frontend/src/components/Common/EmbedYoutube.tsx create mode 100644 rsconcept/frontend/src/hooks/useWindowSize.ts diff --git a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx new file mode 100644 index 00000000..bbb4da35 --- /dev/null +++ b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx @@ -0,0 +1,31 @@ +interface EmbedYoutubeProps { + videoID: string + pxHeight: number + pxWidth?: number +} + +function EmbedYoutube({ videoID, pxHeight, pxWidth }: EmbedYoutubeProps) { + if (!pxWidth) { + pxWidth = pxHeight * 16 / 9; + console.log(pxWidth); + } + return ( +
+