Skip to content

🎥 Make videos programmatically with React

Update CurrentComposition.tsx

Jonny Burger49ee6f087c7d
diff --git a/packages/cli/src/editor/components/CurrentComposition.tsx b/packages/cli/src/editor/components/CurrentComposition.tsx
index db3c0c9ec6..3146312c9d 100644
--- a/packages/cli/src/editor/components/CurrentComposition.tsx
+++ b/packages/cli/src/editor/components/CurrentComposition.tsx
@@ -1,7 +1,8 @@
-import React, {useContext} from 'react';
+import React from 'react';
import {Internals} from 'remotion';
import styled from 'styled-components';
import {renderFrame} from '../state/render-frame';
+import {Thumbnail} from './Thumbnail';
const Container = styled.div`
min-height: 100px;
@@ -24,22 +25,35 @@ const Subtitle = styled.div`
opacity: 0.8;
`;
+const Row = styled.div`
+ display: flex;
+ flex-direction: row;
+`;
+
+const Space = styled.div`
+ width: 12px;
+`;
+
export const CurrentComposition = () => {
- const {currentComposition} = useContext(Internals.CompositionManager);
- const videoConfig = Internals.useUnsafeVideoConfig();
- if (!videoConfig) {
+ const video = Internals.useVideo();
+ if (!video) {
return <Container />;
}
return (
<Container>
- <Title>{currentComposition}</Title>
- <Subtitle>
- {videoConfig.width}x{videoConfig.height}
- </Subtitle>
- <Subtitle>
- Duration {renderFrame(videoConfig.durationInFrames, videoConfig.fps)},{' '}
- {videoConfig.fps} FPS
- </Subtitle>
+ <Row>
+ <Thumbnail composition={video} />
+ <Space />
+ <div>
+ <Title>{video.id}</Title>
+ <Subtitle>
+ {video.width}x{video.height}, {video.fps} FPS
+ </Subtitle>
+ <Subtitle>
+ Duration {renderFrame(video.durationInFrames, video.fps)}
+ </Subtitle>
+ </div>
+ </Row>
</Container>
);
};