import React from "react"; import { interpolate, useCurrentFrame } from "remotion"; import { COLORS, FONT_MONO } from "../lib/colors"; type Row = { dimension: string; cells: [string, string, string]; }; type Props = { startFrame: number; entities: [string, string, string]; rows: Row[]; rowStaggerFrames?: number; }; export const ComparisonTable: React.FC = ({ startFrame, entities, rows, rowStaggerFrames = 18, }) => { const frame = useCurrentFrame(); const headerOpacity = interpolate( frame - startFrame, [0, 12], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }, ); const colTemplate = "1.4fr 1fr 1fr 1fr"; const cellPad = "16px 22px"; return (
Dimension
{entities.map((entity, idx) => (
{entity}
))}
{rows.map((row, idx) => { const rowStart = startFrame + 12 + idx * rowStaggerFrames; const rowOpacity = interpolate( frame - rowStart, [0, 14], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }, ); const rowSlide = interpolate( frame - rowStart, [0, 14], [12, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }, ); return (
{row.dimension}
{row.cells.map((cell, cellIdx) => (
{cell}
))}
); })}
); };