Skip to content

🎥 Make videos programmatically with React

sidebar

Jonny Burger2f9e133ca02a
diff --git a/packages/docs/src/components/VideoPlayerContent.tsx b/packages/docs/src/components/VideoPlayerContent.tsx
index 08db19e6fb..21bab9dad4 100644
--- a/packages/docs/src/components/VideoPlayerContent.tsx
+++ b/packages/docs/src/components/VideoPlayerContent.tsx
@@ -3,10 +3,13 @@ import React, { useRef } from "react";
import styled from "styled-components";
import { ShowcaseVideo } from "../data/showcase-videos";
import { useElementSize } from "../helpers/use-el-size";
+import { VideoSidebar } from "./VideoSidebar";
export const Container = styled.div`
background-color: white;
margin-bottom: 0;
+ display: flex;
+ flex-direction: row;
`;
const Video = styled.video`
@@ -14,6 +17,12 @@ const Video = styled.video`
background-color: white;
`;
+const RESERVED_FOR_SIDEBAR = 300;
+
+const Sidebar = styled.div`
+ width: ${RESERVED_FOR_SIDEBAR}px;
+`;
+
export const VideoPlayerContent: React.FC<{ video: ShowcaseVideo }> = ({
video,
}) => {
@@ -22,7 +31,7 @@ export const VideoPlayerContent: React.FC<{ video: ShowcaseVideo }> = ({
const containerSize = useElementSize(document.body);
- const containerWidth = Math.min(containerSize?.width ?? 0, 1200);
+ const containerWidth = Math.min(containerSize?.width ?? 0, 1200) - 200;
const containerHeight = Math.min(containerSize?.height ?? 0, 800);
const heightRatio = (containerHeight ?? 0) / video.height;
@@ -36,6 +45,9 @@ export const VideoPlayerContent: React.FC<{ video: ShowcaseVideo }> = ({
return (
<Container ref={container}>
<Video src={vidUrl} height={height} width={width} autoPlay></Video>
+ <Sidebar>
+ <VideoSidebar video={video}></VideoSidebar>
+ </Sidebar>
</Container>
);
};