返回 html-video
Root.tsx
1 // Root — registers the native data-rollup composition. The adapter's render.ts
2 // overrides width/height/fps/durationInFrames per call via selectComposition()
3 // and feeds the real data through inputProps. Mirrors bridge/Root.tsx so a 9:16
4 // or 1:1 frame isn't squashed into 16:9. (RFC-08 Phase 2)
5 import React from 'react';
6 import { Composition } from 'remotion';
7 import { DataRollup, type DataRollupProps } from './DataRollup';
8
9 const SAMPLE: DataRollupProps = {
10 data: {
11 title: 'This week on GitHub',
12 unit: '',
13 items: [
14 { label: 'Mon', value: 1200 },
15 { label: 'Tue', value: 2400 },
16 { label: 'Wed', value: 1800 },
17 { label: 'Thu', value: 4200 },
18 { label: 'Fri', value: 3600 },
19 ],
20 },
21 };
22
23 export const RemotionRoot: React.FC = () => {
24 return (
25 <Composition
26 id="DataRollup"
27 component={DataRollup}
28 // Placeholder metadata; render.ts overrides all of these at render time.
29 durationInFrames={150}
30 fps={30}
31 width={1920}
32 height={1080}
33 defaultProps={SAMPLE}
34 calculateMetadata={({ props }) => ({
35 width: (props as { width?: number }).width ?? 1920,
36 height: (props as { height?: number }).height ?? 1080,
37 })}
38 />
39 );
40 };
41
41 lines Plain Text