🎥 Make videos programmatically with React
add some shadcn ui components
Jonny Burger3d950b0030db
diff --git a/packages/convert/app/components/DataTable.tsx b/packages/convert/app/components/DataTable.tsxnew file mode 100644index 0000000000..3ac5d12a3f--- /dev/null+++ b/packages/convert/app/components/DataTable.tsx@@ -0,0 +1,18 @@+import {Table, TableBody, TableCell, TableRow} from '@/components/ui/table';++export const TableDemo = () => {+ return (+ <Table>+ <TableBody>+ <TableRow>+ <TableCell colSpan={3}>Format</TableCell>+ <TableCell className="text-right">MP4</TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Dimensions</TableCell>+ <TableCell className="text-right">1920x1080</TableCell>+ </TableRow>+ </TableBody>+ </Table>+ );+};diff --git a/packages/convert/app/components/VideoPreview.tsx b/packages/convert/app/components/VideoPreview.tsxindex 942e958a89..572e060ab2 100644--- a/packages/convert/app/components/VideoPreview.tsx+++ b/packages/convert/app/components/VideoPreview.tsx@@ -7,46 +7,17 @@ import {CardHeader,CardTitle,} from '@/components/ui/card';-import {Input} from '@/components/ui/input';-import {Label} from '@/components/ui/label';-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from '@/components/ui/select';+import {TableDemo} from './DataTable';export const VideoPreview = () => {return (<Card className="w-[350px]"><CardHeader>- <CardTitle>Create project</CardTitle>+ <CardTitle>bigbuckbunny.mp4</CardTitle><CardDescription>Deploy your new project in one-click.</CardDescription></CardHeader><CardContent>- <form>- <div className="grid w-full items-center gap-4">- <div className="flex flex-col space-y-1.5">- <Label htmlFor="name">Name</Label>- <Input id="name" placeholder="Name of your project" />- </div>- <div className="flex flex-col space-y-1.5">- <Label htmlFor="framework">Framework</Label>- <Select>- <SelectTrigger id="framework">- <SelectValue placeholder="Select" />- </SelectTrigger>- <SelectContent position="popper">- <SelectItem value="next">Next.js</SelectItem>- <SelectItem value="sveltekit">SvelteKit</SelectItem>- <SelectItem value="astro">Astro</SelectItem>- <SelectItem value="nuxt">Nuxt.js</SelectItem>- </SelectContent>- </Select>- </div>- </div>- </form>+ <TableDemo /></CardContent><CardFooter className="flex justify-between"><Button variant="outline">Cancel</Button>diff --git a/packages/convert/app/components/ui/table.tsx b/packages/convert/app/components/ui/table.tsxnew file mode 100644index 0000000000..b3b371107a--- /dev/null+++ b/packages/convert/app/components/ui/table.tsx@@ -0,0 +1,117 @@+import * as React from "react"++import { cn } from "~/lib/utils"++const Table = React.forwardRef<+ HTMLTableElement,+ React.HTMLAttributes<HTMLTableElement>+>(({ className, ...props }, ref) => (+ <div className="relative w-full overflow-auto">+ <table+ ref={ref}+ className={cn("w-full caption-bottom text-sm", className)}+ {...props}+ />+ </div>+))+Table.displayName = "Table"++const TableHeader = React.forwardRef<+ HTMLTableSectionElement,+ React.HTMLAttributes<HTMLTableSectionElement>+>(({ className, ...props }, ref) => (+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />+))+TableHeader.displayName = "TableHeader"++const TableBody = React.forwardRef<+ HTMLTableSectionElement,+ React.HTMLAttributes<HTMLTableSectionElement>+>(({ className, ...props }, ref) => (+ <tbody+ ref={ref}+ className={cn("[&_tr:last-child]:border-0", className)}+ {...props}+ />+))+TableBody.displayName = "TableBody"++const TableFooter = React.forwardRef<+ HTMLTableSectionElement,+ React.HTMLAttributes<HTMLTableSectionElement>+>(({ className, ...props }, ref) => (+ <tfoot+ ref={ref}+ className={cn(+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",+ className+ )}+ {...props}+ />+))+TableFooter.displayName = "TableFooter"++const TableRow = React.forwardRef<+ HTMLTableRowElement,+ React.HTMLAttributes<HTMLTableRowElement>+>(({ className, ...props }, ref) => (+ <tr+ ref={ref}+ className={cn(+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",+ className+ )}+ {...props}+ />+))+TableRow.displayName = "TableRow"++const TableHead = React.forwardRef<+ HTMLTableCellElement,+ React.ThHTMLAttributes<HTMLTableCellElement>+>(({ className, ...props }, ref) => (+ <th+ ref={ref}+ className={cn(+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",+ className+ )}+ {...props}+ />+))+TableHead.displayName = "TableHead"++const TableCell = React.forwardRef<+ HTMLTableCellElement,+ React.TdHTMLAttributes<HTMLTableCellElement>+>(({ className, ...props }, ref) => (+ <td+ ref={ref}+ className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}+ {...props}+ />+))+TableCell.displayName = "TableCell"++const TableCaption = React.forwardRef<+ HTMLTableCaptionElement,+ React.HTMLAttributes<HTMLTableCaptionElement>+>(({ className, ...props }, ref) => (+ <caption+ ref={ref}+ className={cn("mt-4 text-sm text-muted-foreground", className)}+ {...props}+ />+))+TableCaption.displayName = "TableCaption"++export {+ Table,+ TableHeader,+ TableBody,+ TableFooter,+ TableHead,+ TableRow,+ TableCell,+ TableCaption,+}diff --git a/packages/convert/app/routes/_index.tsx b/packages/convert/app/routes/_index.tsxindex 323f825727..9a04171299 100644--- a/packages/convert/app/routes/_index.tsx+++ b/packages/convert/app/routes/_index.tsx@@ -2,6 +2,7 @@ import type {MetaFunction} from '@remix-run/node';import {convertMedia} from '@remotion/webcodecs';import {useCallback, useState} from 'react';import {VideoPreview} from '~/components/VideoPreview';+import {Button} from '~/components/ui/button';export const meta: MetaFunction = () => {return [@@ -37,13 +38,13 @@ const Index = () => {}, [abortController]);return (- <div className="font-sans p-4">- <button type="button" onClick={onClick}>+ <div className="font-sans p-4 flex justify-center items-center h-screen">+ <Button type="button" onClick={onClick}>Convert- </button>- <button type="button" onClick={onAbort}>+ </Button>+ <Button type="button" onClick={onAbort}>Abort- </button>+ </Button><VideoPreview /></div>);