Skip to content

🎥 Make videos programmatically with React

copy hint & colors

Jonny Burger7796d0dfd896
diff --git a/packages/cli/src/editor/components/NewComposition/CopyHint.tsx b/packages/cli/src/editor/components/NewComposition/CopyHint.tsx
new file mode 100644
index 0000000000..70012d67b1
--- /dev/null
+++ b/packages/cli/src/editor/components/NewComposition/CopyHint.tsx
@@ -0,0 +1,15 @@
+import React from 'react';
+import {LIGHT_TEXT} from '../../helpers/colors';
+
+const style: React.CSSProperties = {
+ fontSize: 12,
+ color: LIGHT_TEXT,
+};
+
+export const CopyHint: React.FC = () => {
+ return (
+ <div style={style}>
+ Copy this into <br /> your src/Video.tsx file.
+ </div>
+ );
+};
diff --git a/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx b/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx
index a1e78f4186..b143688528 100644
--- a/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx
+++ b/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx
@@ -5,12 +5,6 @@ import {InputDragger} from './InputDragger';
import {inputArea, leftLabel, rightLabel} from './new-comp-layout';
import {ValidationMessage} from './ValidationMessage';
-const label: React.CSSProperties = {
- fontSize: 13,
- color: 'rgba(255, 255, 255, 0.5)',
- marginLeft: 10,
-};
-
export const NewCompDuration: React.FC<{
durationInFrames: string;
fps: string;
diff --git a/packages/cli/src/editor/components/NewComposition/NewComposition.tsx b/packages/cli/src/editor/components/NewComposition/NewComposition.tsx
index bc177f4e01..2f89d88aad 100644
--- a/packages/cli/src/editor/components/NewComposition/NewComposition.tsx
+++ b/packages/cli/src/editor/components/NewComposition/NewComposition.tsx
@@ -17,10 +17,11 @@ import {
} from '../../state/aspect-ratio-locked';
import {CompType, ModalsContext} from '../../state/modals';
import {CopyButton} from '../CopyButton';
-import {Row, Spacing} from '../layout';
+import {Flex, Row, Spacing} from '../layout';
import {ModalContainer} from '../ModalContainer';
import {NewCompHeader} from '../ModalHeader';
import {Combobox, ComboboxValue} from './ComboBox';
+import {CopyHint} from './CopyHint';
import {InputDragger} from './InputDragger';
import {inputArea, leftLabel} from './new-comp-layout';
import {NewCompAspectRatio} from './NewCompAspectRatio';
@@ -265,13 +266,7 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
</Row>
</label>
<Spacing y={1} />
- <div
- style={{
- display: 'flex',
- flexDirection: 'row',
- alignItems: 'center',
- }}
- >
+ <Row align="center">
<div>
<div>
<label>
@@ -329,7 +324,7 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
setAspectRatioLocked={setAspectRatioLocked}
/>
</div>
- </div>
+ </Row>
<div />
<Spacing y={1} />
{type === 'composition' ? (
@@ -360,7 +355,6 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
) : null}
</form>
</div>
-
<div style={panelRight}>
<pre style={pre}>
{getNewCompositionCode({
@@ -373,13 +367,21 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
raw: false,
})}
</pre>
- <div
+ <Row
+ align="center"
style={{
position: 'absolute',
bottom: 10,
- right: 10,
+ right: 0,
+ paddingRight: 10,
+ paddingLeft: 20,
+ width: '100%',
+ alignItems: 'center',
+ color: leftLabel.color,
}}
>
+ <CopyHint />
+ <Flex />
<CopyButton
label="Copy code"
labelWhenCopied="Copied!"
@@ -395,7 +397,7 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
}) as string
}
/>
- </div>
+ </Row>
</div>
</div>
</ModalContainer>
diff --git a/packages/cli/src/editor/components/NewComposition/new-comp-layout.ts b/packages/cli/src/editor/components/NewComposition/new-comp-layout.ts
index c744ffb867..a6cea3ca20 100644
--- a/packages/cli/src/editor/components/NewComposition/new-comp-layout.ts
+++ b/packages/cli/src/editor/components/NewComposition/new-comp-layout.ts
@@ -1,4 +1,5 @@
import React from 'react';
+import {LIGHT_COLOR, LIGHT_TEXT} from '../../helpers/colors';
export const leftLabel: React.CSSProperties = {
width: 160,
@@ -6,7 +7,7 @@ export const leftLabel: React.CSSProperties = {
textAlign: 'right',
paddingRight: 30,
fontSize: 14,
- color: '#ddd',
+ color: LIGHT_COLOR,
};
export const inputArea: React.CSSProperties = {
@@ -15,6 +16,6 @@ export const inputArea: React.CSSProperties = {
export const rightLabel: React.CSSProperties = {
fontSize: 13,
- color: 'rgba(255, 255, 255, 0.5)',
+ color: LIGHT_TEXT,
marginLeft: 10,
};
diff --git a/packages/cli/src/editor/components/Timeline/TimelineCollapseToggle.tsx b/packages/cli/src/editor/components/Timeline/TimelineCollapseToggle.tsx
index 039a2eebe8..19547a5f2f 100644
--- a/packages/cli/src/editor/components/Timeline/TimelineCollapseToggle.tsx
+++ b/packages/cli/src/editor/components/Timeline/TimelineCollapseToggle.tsx
@@ -1,4 +1,5 @@
import React, {SVGProps} from 'react';
+import {LIGHT_COLOR} from '../../helpers/colors';
const container: React.CSSProperties = {
height: 10,
@@ -11,7 +12,7 @@ const container: React.CSSProperties = {
const Icon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
return (
<svg viewBox="0 0 8 10" {...props} style={{height: 10, width: 8}}>
- <path d="M 0 0 L 8 5 L 0 10 z" fill="#ddd" />
+ <path d="M 0 0 L 8 5 L 0 10 z" fill={LIGHT_COLOR} />
</svg>
);
};
diff --git a/packages/cli/src/editor/helpers/colors.ts b/packages/cli/src/editor/helpers/colors.ts
index 571928d3d1..853538f5db 100644
--- a/packages/cli/src/editor/helpers/colors.ts
+++ b/packages/cli/src/editor/helpers/colors.ts
@@ -1,6 +1,7 @@
export const BACKGROUND = '#1f2428';
export const INPUT_BACKGROUND = '#2f363d';
export const BORDER_COLOR = '#000';
+export const LIGHT_COLOR = '#ddd';
export const SELECTED_BACKGROUND = 'hsla(0, 0%, 100%, 0.15)';
export const LIGHT_TEXT = 'rgba(255, 255, 255, 0.6)';
export const SELECTED_HOVER_BACKGROUND = 'hsla(0, 0%, 100%, 0.25)';