@remotion/promo-pages 5.0.0-canary → 5.0.0-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Homepage.js +1 -1
- package/dist/homepage/Pricing.js +1 -1
- package/package.json +15 -12
- package/.turbo/turbo-make.log +0 -8
- package/bundle.ts +0 -38
- package/eslint.config.mjs +0 -7
- package/index.html +0 -13
- package/public/fire.mp3 +0 -0
- package/public/img/cluster.png +0 -0
- package/public/img/code-sample-new.png +0 -0
- package/public/img/freelancers/alex.jpeg +0 -0
- package/public/img/freelancers/antoine.jpeg +0 -0
- package/public/img/freelancers/ayush.png +0 -0
- package/public/img/freelancers/benjamin.jpeg +0 -0
- package/public/img/freelancers/default.png +0 -0
- package/public/img/freelancers/florent.jpeg +0 -0
- package/public/img/freelancers/karel.jpeg +0 -0
- package/public/img/freelancers/lorenzo.jpeg +0 -0
- package/public/img/freelancers/mickael.jpeg +0 -0
- package/public/img/freelancers/mohit.jpeg +0 -0
- package/public/img/freelancers/pramod.jpg +0 -0
- package/public/img/freelancers/pranav.jpg +0 -0
- package/public/img/freelancers/rahul.png +0 -0
- package/public/img/freelancers/ray.jpeg +0 -0
- package/public/img/freelancers/stephen.png +0 -0
- package/public/img/freelancers/umungo.png +0 -0
- package/public/img/freelancers/yehor.jpeg +0 -0
- package/public/img/gt-planar-black.woff2 +0 -0
- package/public/img/gt-planar-bold.woff2 +0 -0
- package/public/img/gt-planar-medium.woff2 +0 -0
- package/public/img/gt-planar-regular.woff2 +0 -0
- package/public/img/logo-small.png +0 -0
- package/public/img/mp4.png +0 -0
- package/public/img/player-demo.mp4 +0 -0
- package/public/img/player-example-dark.png +0 -0
- package/public/img/player-example.png +0 -0
- package/public/img/writeinreact.png +0 -0
- package/public/partyhorn.mp3 +0 -0
- package/public/sad.mp3 +0 -0
- package/src/cn.ts +0 -6
- package/src/components/Homepage.tsx +0 -88
- package/src/components/homepage/BackgroundAnimation.tsx +0 -108
- package/src/components/homepage/ChooseTemplate.tsx +0 -57
- package/src/components/homepage/CodeExample.tsx +0 -89
- package/src/components/homepage/CommunityStats.tsx +0 -54
- package/src/components/homepage/CommunityStatsItems.tsx +0 -304
- package/src/components/homepage/Counter.tsx +0 -110
- package/src/components/homepage/Demo/Card.tsx +0 -273
- package/src/components/homepage/Demo/Cards.tsx +0 -129
- package/src/components/homepage/Demo/Comp.tsx +0 -157
- package/src/components/homepage/Demo/CurrentCountry.tsx +0 -97
- package/src/components/homepage/Demo/DemoError.tsx +0 -18
- package/src/components/homepage/Demo/DemoErrorIcon.tsx +0 -32
- package/src/components/homepage/Demo/DemoRender.tsx +0 -166
- package/src/components/homepage/Demo/DigitWheel.tsx +0 -179
- package/src/components/homepage/Demo/DisplayedEmoji.tsx +0 -81
- package/src/components/homepage/Demo/DoneCheckmark.tsx +0 -39
- package/src/components/homepage/Demo/DownloadNudge.tsx +0 -62
- package/src/components/homepage/Demo/DragAndDropNudge.tsx +0 -57
- package/src/components/homepage/Demo/EmojiCard.tsx +0 -198
- package/src/components/homepage/Demo/Minus.tsx +0 -21
- package/src/components/homepage/Demo/PlayPauseButton.tsx +0 -66
- package/src/components/homepage/Demo/PlayerControls.tsx +0 -48
- package/src/components/homepage/Demo/PlayerSeekBar.tsx +0 -325
- package/src/components/homepage/Demo/PlayerVolume.tsx +0 -83
- package/src/components/homepage/Demo/Progress.tsx +0 -38
- package/src/components/homepage/Demo/Spinner.tsx +0 -60
- package/src/components/homepage/Demo/Switcher.tsx +0 -54
- package/src/components/homepage/Demo/Temperature.tsx +0 -44
- package/src/components/homepage/Demo/TemperatureNumber.tsx +0 -68
- package/src/components/homepage/Demo/ThemeNudge.tsx +0 -72
- package/src/components/homepage/Demo/TimeDisplay.tsx +0 -43
- package/src/components/homepage/Demo/TrendingRepos.tsx +0 -106
- package/src/components/homepage/Demo/icons.tsx +0 -114
- package/src/components/homepage/Demo/index.tsx +0 -158
- package/src/components/homepage/Demo/math.ts +0 -43
- package/src/components/homepage/Demo/types.ts +0 -6
- package/src/components/homepage/Editor.tsx +0 -67
- package/src/components/homepage/EvaluateRemotion.tsx +0 -92
- package/src/components/homepage/FreePricing.tsx +0 -295
- package/src/components/homepage/GetStartedStrip.tsx +0 -77
- package/src/components/homepage/GitHubButton.tsx +0 -23
- package/src/components/homepage/IconForTemplate.tsx +0 -154
- package/src/components/homepage/IfYouKnowReact.tsx +0 -29
- package/src/components/homepage/InfoTooltip.tsx +0 -25
- package/src/components/homepage/MoreTemplatesButton.tsx +0 -29
- package/src/components/homepage/MuxVideo.tsx +0 -68
- package/src/components/homepage/NewsletterButton.tsx +0 -88
- package/src/components/homepage/Pricing.tsx +0 -49
- package/src/components/homepage/PricingBulletPoint.tsx +0 -50
- package/src/components/homepage/RealMp4Videos.tsx +0 -50
- package/src/components/homepage/Spacer.tsx +0 -5
- package/src/components/homepage/TemplateIcon.tsx +0 -36
- package/src/components/homepage/TextInput.tsx +0 -62
- package/src/components/homepage/TrustedByBanner.tsx +0 -194
- package/src/components/homepage/VideoApps.tsx +0 -231
- package/src/components/homepage/VideoAppsShowcase.tsx +0 -276
- package/src/components/homepage/VideoAppsTitle.tsx +0 -24
- package/src/components/homepage/VideoPlayerWithControls.tsx +0 -188
- package/src/components/homepage/WriteInReact.tsx +0 -34
- package/src/components/homepage/YouAreHere.tsx +0 -30
- package/src/components/homepage/custom.css +0 -57
- package/src/components/homepage/layout/Button.tsx +0 -93
- package/src/components/homepage/layout/colors.ts +0 -17
- package/src/components/homepage/layout/use-color-mode.tsx +0 -44
- package/src/components/homepage/layout/use-el-size.ts +0 -51
- package/src/components/homepage/layout/use-mobile-layout.ts +0 -8
- package/src/components/homepage/video-player.css +0 -24
- package/src/components/icons/blank.tsx +0 -13
- package/src/components/icons/clone.tsx +0 -10
- package/src/components/icons/code-hike.tsx +0 -15
- package/src/components/icons/cubes.tsx +0 -13
- package/src/components/icons/js.tsx +0 -17
- package/src/components/icons/next.tsx +0 -64
- package/src/components/icons/overlay.tsx +0 -24
- package/src/components/icons/remix.tsx +0 -24
- package/src/components/icons/skia.tsx +0 -13
- package/src/components/icons/stargazer.tsx +0 -13
- package/src/components/icons/still.tsx +0 -13
- package/src/components/icons/tailwind.tsx +0 -22
- package/src/components/icons/tiktok.tsx +0 -13
- package/src/components/icons/ts.tsx +0 -18
- package/src/components/icons/tts.tsx +0 -13
- package/src/components/icons/undo.tsx +0 -11
- package/src/components/icons/waveform.tsx +0 -13
- package/src/fonts.css +0 -30
- package/src/index.css +0 -74
- package/src/main.tsx +0 -12
- package/tsconfig.json +0 -15
- package/vite.config.ts +0 -9
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type {PlayerRef} from '@remotion/player';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {PALETTE} from '../layout/colors';
|
|
4
|
-
import {PlayerSeekBar} from './PlayerSeekBar';
|
|
5
|
-
import {PlayerVolume} from './PlayerVolume';
|
|
6
|
-
import {PlayPauseButton} from './PlayPauseButton';
|
|
7
|
-
import {TimeDisplay} from './TimeDisplay';
|
|
8
|
-
|
|
9
|
-
const Separator: React.FC = () => {
|
|
10
|
-
return (
|
|
11
|
-
<div
|
|
12
|
-
style={{
|
|
13
|
-
borderRight: `2px solid ${PALETTE.BOX_STROKE}`,
|
|
14
|
-
height: 50,
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const PlayerControls: React.FC<{
|
|
21
|
-
readonly playerRef: React.RefObject<PlayerRef | null>;
|
|
22
|
-
readonly durationInFrames: number;
|
|
23
|
-
readonly fps: number;
|
|
24
|
-
readonly children: React.ReactNode;
|
|
25
|
-
}> = ({playerRef, durationInFrames, fps, children}) => {
|
|
26
|
-
return (
|
|
27
|
-
<div className={'flex flex-row items-center bg-pane'}>
|
|
28
|
-
<PlayPauseButton playerRef={playerRef} />
|
|
29
|
-
<Separator />
|
|
30
|
-
<PlayerVolume playerRef={playerRef} />
|
|
31
|
-
<Separator />
|
|
32
|
-
<div style={{width: 15}} />
|
|
33
|
-
<TimeDisplay playerRef={playerRef} fps={fps} />
|
|
34
|
-
<div style={{width: 15}} />
|
|
35
|
-
<PlayerSeekBar
|
|
36
|
-
durationInFrames={durationInFrames}
|
|
37
|
-
playerRef={playerRef}
|
|
38
|
-
inFrame={null}
|
|
39
|
-
outFrame={null}
|
|
40
|
-
onSeekEnd={() => undefined}
|
|
41
|
-
onSeekStart={() => undefined}
|
|
42
|
-
/>
|
|
43
|
-
<div style={{width: 20}} />
|
|
44
|
-
<Separator />
|
|
45
|
-
{children}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import type {PlayerRef} from '@remotion/player';
|
|
2
|
-
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
3
|
-
import {interpolate} from 'remotion';
|
|
4
|
-
import {useElementSize} from '../layout/use-el-size';
|
|
5
|
-
|
|
6
|
-
const getFrameFromX = (
|
|
7
|
-
clientX: number,
|
|
8
|
-
durationInFrames: number,
|
|
9
|
-
width: number,
|
|
10
|
-
) => {
|
|
11
|
-
const pos = clientX;
|
|
12
|
-
const frame = Math.round(
|
|
13
|
-
interpolate(pos, [0, width], [0, durationInFrames - 1], {
|
|
14
|
-
extrapolateLeft: 'clamp',
|
|
15
|
-
extrapolateRight: 'clamp',
|
|
16
|
-
}),
|
|
17
|
-
);
|
|
18
|
-
return frame;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const BAR_HEIGHT = 5;
|
|
22
|
-
const KNOB_SIZE = 12;
|
|
23
|
-
const VERTICAL_PADDING = 4;
|
|
24
|
-
|
|
25
|
-
const containerStyle: React.CSSProperties = {
|
|
26
|
-
userSelect: 'none',
|
|
27
|
-
WebkitUserSelect: 'none',
|
|
28
|
-
paddingTop: VERTICAL_PADDING,
|
|
29
|
-
paddingBottom: VERTICAL_PADDING,
|
|
30
|
-
boxSizing: 'border-box',
|
|
31
|
-
cursor: 'pointer',
|
|
32
|
-
position: 'relative',
|
|
33
|
-
touchAction: 'none',
|
|
34
|
-
flex: 1,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const barBackground: React.CSSProperties = {
|
|
38
|
-
height: BAR_HEIGHT,
|
|
39
|
-
backgroundColor: 'rgba(0, 0, 0, 0.25)',
|
|
40
|
-
width: '100%',
|
|
41
|
-
borderRadius: BAR_HEIGHT / 2,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const findBodyInWhichDivIsLocated = (div: HTMLElement) => {
|
|
45
|
-
let current = div;
|
|
46
|
-
|
|
47
|
-
while (current.parentElement) {
|
|
48
|
-
current = current.parentElement;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return current;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const useHoverState = (
|
|
55
|
-
ref: React.RefObject<HTMLDivElement | null>,
|
|
56
|
-
hideControlsWhenPointerDoesntMove: boolean | number,
|
|
57
|
-
) => {
|
|
58
|
-
const [hovered, setHovered] = useState(false);
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const {current} = ref;
|
|
62
|
-
if (!current) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let hoverTimeout: Timer;
|
|
67
|
-
const addHoverTimeout = () => {
|
|
68
|
-
if (hideControlsWhenPointerDoesntMove) {
|
|
69
|
-
clearTimeout(hoverTimeout);
|
|
70
|
-
hoverTimeout = setTimeout(
|
|
71
|
-
() => {
|
|
72
|
-
setHovered(false);
|
|
73
|
-
},
|
|
74
|
-
hideControlsWhenPointerDoesntMove === true
|
|
75
|
-
? 3000
|
|
76
|
-
: hideControlsWhenPointerDoesntMove,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onHover = () => {
|
|
82
|
-
setHovered(true);
|
|
83
|
-
addHoverTimeout();
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const onLeave = () => {
|
|
87
|
-
setHovered(false);
|
|
88
|
-
clearTimeout(hoverTimeout);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const onMove = () => {
|
|
92
|
-
setHovered(true);
|
|
93
|
-
addHoverTimeout();
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
current.addEventListener('mouseenter', onHover);
|
|
97
|
-
current.addEventListener('mouseleave', onLeave);
|
|
98
|
-
current.addEventListener('mousemove', onMove);
|
|
99
|
-
|
|
100
|
-
return () => {
|
|
101
|
-
current.removeEventListener('mouseenter', onHover);
|
|
102
|
-
current.removeEventListener('mouseleave', onLeave);
|
|
103
|
-
current.removeEventListener('mousemove', onMove);
|
|
104
|
-
clearTimeout(hoverTimeout);
|
|
105
|
-
};
|
|
106
|
-
}, [hideControlsWhenPointerDoesntMove, ref]);
|
|
107
|
-
return hovered;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const PlayerSeekBar: React.FC<{
|
|
111
|
-
readonly durationInFrames: number;
|
|
112
|
-
readonly onSeekStart: () => void;
|
|
113
|
-
readonly onSeekEnd: () => void;
|
|
114
|
-
readonly inFrame: number | null;
|
|
115
|
-
readonly outFrame: number | null;
|
|
116
|
-
readonly playerRef: React.RefObject<PlayerRef | null>;
|
|
117
|
-
}> = ({
|
|
118
|
-
durationInFrames,
|
|
119
|
-
onSeekEnd,
|
|
120
|
-
onSeekStart,
|
|
121
|
-
inFrame,
|
|
122
|
-
outFrame,
|
|
123
|
-
playerRef,
|
|
124
|
-
}) => {
|
|
125
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
126
|
-
const barHovered = useHoverState(containerRef, false);
|
|
127
|
-
const size = useElementSize(containerRef.current);
|
|
128
|
-
const [playing, setPlaying] = useState(false);
|
|
129
|
-
|
|
130
|
-
const [frame, setFrame] = useState(0);
|
|
131
|
-
|
|
132
|
-
useEffect(() => {
|
|
133
|
-
const {current} = playerRef;
|
|
134
|
-
if (!current) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const onFrameUpdate = () => {
|
|
139
|
-
setFrame(playerRef.current!.getCurrentFrame());
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
current.addEventListener('frameupdate', onFrameUpdate);
|
|
143
|
-
|
|
144
|
-
return () => {
|
|
145
|
-
current.removeEventListener('frameupdate', onFrameUpdate);
|
|
146
|
-
};
|
|
147
|
-
}, [playerRef]);
|
|
148
|
-
|
|
149
|
-
useEffect(() => {
|
|
150
|
-
const {current} = playerRef;
|
|
151
|
-
if (!current) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const onPlay = () => {
|
|
156
|
-
setPlaying(true);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const onPause = () => {
|
|
160
|
-
setPlaying(false);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
current.addEventListener('play', onPlay);
|
|
164
|
-
current.addEventListener('pause', onPause);
|
|
165
|
-
|
|
166
|
-
return () => {
|
|
167
|
-
current.removeEventListener('play', onPlay);
|
|
168
|
-
current.removeEventListener('pause', onPause);
|
|
169
|
-
};
|
|
170
|
-
}, [playerRef]);
|
|
171
|
-
|
|
172
|
-
const [dragging, setDragging] = useState<
|
|
173
|
-
| {
|
|
174
|
-
dragging: false;
|
|
175
|
-
}
|
|
176
|
-
| {
|
|
177
|
-
dragging: true;
|
|
178
|
-
wasPlaying: boolean;
|
|
179
|
-
}
|
|
180
|
-
>({
|
|
181
|
-
dragging: false,
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
const width = size?.width ?? 0;
|
|
185
|
-
|
|
186
|
-
const onPointerDown = useCallback(
|
|
187
|
-
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
188
|
-
if (e.button !== 0) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const posLeft = containerRef.current?.getBoundingClientRect()
|
|
193
|
-
.left as number;
|
|
194
|
-
|
|
195
|
-
const _frame = getFrameFromX(
|
|
196
|
-
e.clientX - posLeft,
|
|
197
|
-
durationInFrames,
|
|
198
|
-
width,
|
|
199
|
-
);
|
|
200
|
-
playerRef.current!.pause();
|
|
201
|
-
playerRef.current!.seekTo(_frame);
|
|
202
|
-
setDragging({
|
|
203
|
-
dragging: true,
|
|
204
|
-
wasPlaying: playing,
|
|
205
|
-
});
|
|
206
|
-
onSeekStart();
|
|
207
|
-
},
|
|
208
|
-
[durationInFrames, width, playerRef, playing, onSeekStart],
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
const onPointerMove = useCallback(
|
|
212
|
-
(e: PointerEvent) => {
|
|
213
|
-
if (!size) {
|
|
214
|
-
throw new Error('Player has no size');
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (!dragging.dragging) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const posLeft = containerRef.current?.getBoundingClientRect()
|
|
222
|
-
.left as number;
|
|
223
|
-
|
|
224
|
-
const _frame = getFrameFromX(
|
|
225
|
-
e.clientX - posLeft,
|
|
226
|
-
durationInFrames,
|
|
227
|
-
size.width,
|
|
228
|
-
);
|
|
229
|
-
playerRef.current!.seekTo(_frame);
|
|
230
|
-
},
|
|
231
|
-
[dragging.dragging, durationInFrames, playerRef, size],
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
const onPointerUp = useCallback(() => {
|
|
235
|
-
setDragging({
|
|
236
|
-
dragging: false,
|
|
237
|
-
});
|
|
238
|
-
if (!dragging.dragging) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (dragging.wasPlaying) {
|
|
243
|
-
playerRef.current!.play();
|
|
244
|
-
} else {
|
|
245
|
-
playerRef.current!.pause();
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
onSeekEnd();
|
|
249
|
-
}, [dragging, onSeekEnd, playerRef]);
|
|
250
|
-
|
|
251
|
-
useEffect(() => {
|
|
252
|
-
if (!dragging.dragging) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const body = findBodyInWhichDivIsLocated(
|
|
257
|
-
containerRef.current as HTMLElement,
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
body.addEventListener('pointermove', onPointerMove);
|
|
261
|
-
body.addEventListener('pointerup', onPointerUp);
|
|
262
|
-
return () => {
|
|
263
|
-
body.removeEventListener('pointermove', onPointerMove);
|
|
264
|
-
body.removeEventListener('pointerup', onPointerUp);
|
|
265
|
-
};
|
|
266
|
-
}, [dragging.dragging, onPointerMove, onPointerUp]);
|
|
267
|
-
|
|
268
|
-
const knobStyle: React.CSSProperties = useMemo(() => {
|
|
269
|
-
return {
|
|
270
|
-
height: KNOB_SIZE,
|
|
271
|
-
width: KNOB_SIZE,
|
|
272
|
-
borderRadius: KNOB_SIZE / 2,
|
|
273
|
-
position: 'absolute',
|
|
274
|
-
top: VERTICAL_PADDING - KNOB_SIZE / 2 + 5 / 2,
|
|
275
|
-
backgroundColor: 'var(--ifm-font-color-base)',
|
|
276
|
-
left: Math.max(
|
|
277
|
-
0,
|
|
278
|
-
(frame / Math.max(1, durationInFrames - 1)) * width - KNOB_SIZE / 2,
|
|
279
|
-
),
|
|
280
|
-
outline: '2px solid var(--ifm-background-color)',
|
|
281
|
-
opacity: Number(barHovered),
|
|
282
|
-
transition: 'opacity 0.s ease',
|
|
283
|
-
};
|
|
284
|
-
}, [barHovered, durationInFrames, frame, width]);
|
|
285
|
-
|
|
286
|
-
const fillStyle: React.CSSProperties = useMemo(() => {
|
|
287
|
-
return {
|
|
288
|
-
height: BAR_HEIGHT,
|
|
289
|
-
backgroundColor: 'var(--ifm-font-color-base)',
|
|
290
|
-
width: ((frame - (inFrame ?? 0)) / (durationInFrames - 1)) * 100 + '%',
|
|
291
|
-
marginLeft: ((inFrame ?? 0) / (durationInFrames - 1)) * 100 + '%',
|
|
292
|
-
borderRadius: BAR_HEIGHT / 2,
|
|
293
|
-
};
|
|
294
|
-
}, [durationInFrames, frame, inFrame]);
|
|
295
|
-
|
|
296
|
-
const active: React.CSSProperties = useMemo(() => {
|
|
297
|
-
return {
|
|
298
|
-
height: BAR_HEIGHT,
|
|
299
|
-
backgroundColor: 'var(--ifm-font-color-base)',
|
|
300
|
-
opacity: 0.2,
|
|
301
|
-
width:
|
|
302
|
-
(((outFrame ?? durationInFrames - 1) - (inFrame ?? 0)) /
|
|
303
|
-
(durationInFrames - 1)) *
|
|
304
|
-
100 +
|
|
305
|
-
'%',
|
|
306
|
-
marginLeft: ((inFrame ?? 0) / (durationInFrames - 1)) * 100 + '%',
|
|
307
|
-
borderRadius: BAR_HEIGHT / 2,
|
|
308
|
-
position: 'absolute',
|
|
309
|
-
};
|
|
310
|
-
}, [durationInFrames, inFrame, outFrame]);
|
|
311
|
-
|
|
312
|
-
return (
|
|
313
|
-
<div
|
|
314
|
-
ref={containerRef}
|
|
315
|
-
onPointerDown={onPointerDown}
|
|
316
|
-
style={containerStyle}
|
|
317
|
-
>
|
|
318
|
-
<div style={barBackground}>
|
|
319
|
-
<div style={active} />
|
|
320
|
-
<div style={fillStyle} />
|
|
321
|
-
</div>
|
|
322
|
-
<div style={knobStyle} />
|
|
323
|
-
</div>
|
|
324
|
-
);
|
|
325
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type {CallbackListener, PlayerRef} from '@remotion/player';
|
|
2
|
-
import React, {useCallback, useEffect, useRef, useState} from 'react';
|
|
3
|
-
import {PALETTE} from '../layout/colors';
|
|
4
|
-
import {IsMutedIcon, NotMutedIcon} from './icons';
|
|
5
|
-
|
|
6
|
-
export const PlayerVolume: React.FC<{
|
|
7
|
-
readonly playerRef: React.RefObject<PlayerRef | null>;
|
|
8
|
-
}> = ({playerRef}) => {
|
|
9
|
-
const [muted, setIsMuted] = useState(
|
|
10
|
-
() => playerRef.current?.isMuted() ?? true,
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
14
|
-
const timerRef = useRef<Timer | null>(null);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const {current} = playerRef;
|
|
18
|
-
|
|
19
|
-
if (!current) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const onMutedChange: CallbackListener<'mutechange'> = (e) => {
|
|
24
|
-
setIsMuted(e.detail.isMuted);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
current.addEventListener('mutechange', onMutedChange);
|
|
28
|
-
|
|
29
|
-
return () => {
|
|
30
|
-
current.removeEventListener('mutechange', onMutedChange);
|
|
31
|
-
};
|
|
32
|
-
}, [playerRef]);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (isHovered) {
|
|
36
|
-
document.body.style.userSelect = 'none';
|
|
37
|
-
} else {
|
|
38
|
-
document.body.style.userSelect = 'auto';
|
|
39
|
-
}
|
|
40
|
-
}, [isHovered]);
|
|
41
|
-
|
|
42
|
-
const onClick = useCallback(() => {
|
|
43
|
-
if (timerRef.current !== null) {
|
|
44
|
-
clearTimeout(timerRef.current);
|
|
45
|
-
timerRef.current = null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (playerRef.current!.isMuted()) {
|
|
49
|
-
playerRef.current!.unmute();
|
|
50
|
-
} else {
|
|
51
|
-
playerRef.current!.mute();
|
|
52
|
-
}
|
|
53
|
-
}, [playerRef]);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<div
|
|
57
|
-
className={'relative cursor-pointer block pl-4 pr-4 h-full'}
|
|
58
|
-
onMouseEnter={() => setIsHovered(true)}
|
|
59
|
-
>
|
|
60
|
-
<button
|
|
61
|
-
type="button"
|
|
62
|
-
onClick={onClick}
|
|
63
|
-
style={{
|
|
64
|
-
background: 'transparent',
|
|
65
|
-
border: 0,
|
|
66
|
-
cursor: 'pointer',
|
|
67
|
-
padding: 0,
|
|
68
|
-
display: 'flex',
|
|
69
|
-
height: 50,
|
|
70
|
-
justifyContent: 'center',
|
|
71
|
-
alignItems: 'center',
|
|
72
|
-
color: PALETTE.TEXT_COLOR,
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{muted ? (
|
|
76
|
-
<IsMutedIcon style={{height: 20}} />
|
|
77
|
-
) : (
|
|
78
|
-
<NotMutedIcon style={{height: 20}} />
|
|
79
|
-
)}
|
|
80
|
-
</button>
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {makeCircle, makePie} from '@remotion/shapes';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {PALETTE} from '../layout/colors';
|
|
4
|
-
|
|
5
|
-
export const Progress: React.FC<{
|
|
6
|
-
readonly progress: number;
|
|
7
|
-
}> = ({progress}) => {
|
|
8
|
-
const inner = makeCircle({
|
|
9
|
-
radius: 10,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const outer = makePie({
|
|
13
|
-
progress,
|
|
14
|
-
closePath: false,
|
|
15
|
-
radius: 10,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<svg
|
|
20
|
-
viewBox={`0 0 ${inner.width} ${inner.height}`}
|
|
21
|
-
style={{overflow: 'visible', height: 22}}
|
|
22
|
-
>
|
|
23
|
-
<path
|
|
24
|
-
d={inner.path}
|
|
25
|
-
stroke={PALETTE.BORDER_COLOR}
|
|
26
|
-
strokeWidth={4}
|
|
27
|
-
fill="transparent"
|
|
28
|
-
/>
|
|
29
|
-
<path
|
|
30
|
-
d={outer.path}
|
|
31
|
-
stroke={PALETTE.BRAND}
|
|
32
|
-
strokeWidth={4}
|
|
33
|
-
fill="transparent"
|
|
34
|
-
strokeLinecap="round"
|
|
35
|
-
/>
|
|
36
|
-
</svg>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, {useMemo} from 'react';
|
|
2
|
-
import {PALETTE} from '../layout/colors';
|
|
3
|
-
|
|
4
|
-
const viewBox = 100;
|
|
5
|
-
const lines = 8;
|
|
6
|
-
const className = '__remotion_spinner_line';
|
|
7
|
-
const remotionSpinnerAnimation = '__remotion_spinner_animation';
|
|
8
|
-
|
|
9
|
-
// Generated from https://github.com/remotion-dev/template-next/commit/9282c93f7c51ada31a42e18a94680fa09a14eee3
|
|
10
|
-
const translated =
|
|
11
|
-
'M 44 0 L 50 0 a 6 6 0 0 1 6 6 L 56 26 a 6 6 0 0 1 -6 6 L 50 32 a 6 6 0 0 1 -6 -6 L 44 6 a 6 6 0 0 1 6 -6 Z';
|
|
12
|
-
|
|
13
|
-
export const Spinner: React.FC<{
|
|
14
|
-
readonly size: number;
|
|
15
|
-
readonly duration: number;
|
|
16
|
-
}> = ({size, duration}) => {
|
|
17
|
-
const style = useMemo(() => {
|
|
18
|
-
return {
|
|
19
|
-
width: size,
|
|
20
|
-
height: size,
|
|
21
|
-
};
|
|
22
|
-
}, [size]);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<style type="text/css">{`
|
|
27
|
-
@keyframes ${remotionSpinnerAnimation} {
|
|
28
|
-
0% {
|
|
29
|
-
opacity: 1;
|
|
30
|
-
}
|
|
31
|
-
100% {
|
|
32
|
-
opacity: 0.15;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.${className} {
|
|
37
|
-
animation: ${remotionSpinnerAnimation} ${duration}s linear infinite;
|
|
38
|
-
}
|
|
39
|
-
`}</style>
|
|
40
|
-
<svg style={style} viewBox={`0 0 ${viewBox} ${viewBox}`}>
|
|
41
|
-
{new Array(lines).fill(true).map((_, index) => {
|
|
42
|
-
return (
|
|
43
|
-
<path
|
|
44
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
45
|
-
key={index}
|
|
46
|
-
className={className}
|
|
47
|
-
style={{
|
|
48
|
-
rotate: `${(index * Math.PI * 2) / lines}rad`,
|
|
49
|
-
transformOrigin: 'center center',
|
|
50
|
-
animationDelay: `${index * (duration / lines) - duration}s`,
|
|
51
|
-
}}
|
|
52
|
-
d={translated}
|
|
53
|
-
fill={PALETTE.TEXT_COLOR}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
})}
|
|
57
|
-
</svg>
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React, {useCallback} from 'react';
|
|
2
|
-
|
|
3
|
-
export const Switcher: React.FC<{
|
|
4
|
-
readonly type: 'left' | 'right';
|
|
5
|
-
readonly theme: 'dark' | 'light';
|
|
6
|
-
readonly onTap: () => void;
|
|
7
|
-
}> = ({type, theme, onTap}) => {
|
|
8
|
-
const onPointerDown = useCallback(
|
|
9
|
-
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
10
|
-
e.stopPropagation();
|
|
11
|
-
onTap();
|
|
12
|
-
},
|
|
13
|
-
[onTap],
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const switcherSize = 40;
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div
|
|
20
|
-
onPointerDown={onPointerDown}
|
|
21
|
-
style={{
|
|
22
|
-
height: switcherSize,
|
|
23
|
-
width: switcherSize,
|
|
24
|
-
borderRadius: switcherSize / 2,
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
marginLeft: -switcherSize / 2,
|
|
27
|
-
top: '50%',
|
|
28
|
-
left: type === 'left' ? 0 : '100%',
|
|
29
|
-
marginTop: -switcherSize / 2,
|
|
30
|
-
backgroundColor: theme === 'dark' ? '#222' : '#fafafa',
|
|
31
|
-
color: theme === 'dark' ? 'white' : '#222',
|
|
32
|
-
cursor: 'pointer',
|
|
33
|
-
justifyContent: 'center',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
display: 'flex',
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
<svg style={{height: switcherSize / 2}} viewBox="0 0 320 512">
|
|
39
|
-
{type === 'left' ? (
|
|
40
|
-
<path
|
|
41
|
-
fill="currentcolor"
|
|
42
|
-
d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"
|
|
43
|
-
/>
|
|
44
|
-
) : null}
|
|
45
|
-
{type === 'right' ? (
|
|
46
|
-
<path
|
|
47
|
-
fill="currentcolor"
|
|
48
|
-
d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"
|
|
49
|
-
/>
|
|
50
|
-
) : null}
|
|
51
|
-
</svg>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {AbsoluteFill} from 'remotion';
|
|
3
|
-
import {TemperatureNumber} from './TemperatureNumber';
|
|
4
|
-
|
|
5
|
-
export const Temperature: React.FC<{
|
|
6
|
-
readonly theme: 'dark' | 'light';
|
|
7
|
-
readonly city: string | null;
|
|
8
|
-
readonly temperatureInCelsius: number | null;
|
|
9
|
-
}> = ({theme, city, temperatureInCelsius}) => {
|
|
10
|
-
if (temperatureInCelsius === null) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<AbsoluteFill>
|
|
16
|
-
<AbsoluteFill
|
|
17
|
-
style={{
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
justifyContent: 'center',
|
|
20
|
-
paddingLeft: 20,
|
|
21
|
-
paddingRight: 20,
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
<div
|
|
25
|
-
style={{
|
|
26
|
-
color: '#0b84f3',
|
|
27
|
-
fontFamily: 'GTPlanar',
|
|
28
|
-
fontWeight: '500',
|
|
29
|
-
fontSize: 13,
|
|
30
|
-
textAlign: 'center',
|
|
31
|
-
marginTop: 5,
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
Temperature in {city}
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<TemperatureNumber
|
|
38
|
-
theme={theme}
|
|
39
|
-
temperatureInCelsius={temperatureInCelsius}
|
|
40
|
-
/>
|
|
41
|
-
</AbsoluteFill>
|
|
42
|
-
</AbsoluteFill>
|
|
43
|
-
);
|
|
44
|
-
};
|