1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-05 20:15:31 -04:00
Files
jarv.is/components/video.tsx
T
jake 5a1636baa3 refactor: migrate from Biome to oxlint/oxfmt, remove contact form
- Replace Biome with oxlint + oxfmt (OXC toolchain) for linting and formatting
- Add .oxlintrc.json and .oxfmtrc.json configuration files
- Update VS Code settings and devcontainer to use oxc-vscode extension
- Remove contact form, Resend email integration, and related server action/schema
- Remove unused UI components (accordion, alert, card, tabs, toggle, etc.)
2026-04-05 19:45:18 -04:00

53 lines
1.2 KiB
TypeScript

import { cn } from "@/lib/utils";
const Video = ({
src,
autoPlay,
className,
children,
...rest
}: Omit<Partial<React.ComponentProps<"video">>, "src"> & {
src: string | string[] | undefined;
}) => {
return (
<video
{...(typeof src === "string" ? { src } : {})}
{...(autoPlay
? {
autoPlay: true,
preload: "auto",
controls: false,
playsInline: true, // safari autoplay workaround
loop: true,
muted: true,
}
: {
autoPlay: false,
preload: "metadata",
controls: true,
playsInline: true,
})}
crossOrigin="anonymous"
className={cn("mx-auto block h-auto max-h-[500px] w-full", className)}
{...rest}
>
{Array.isArray(src) &&
src.map((file) => {
const extension = file.split(".").pop();
if (extension === "vtt") {
return (
<track key={file} kind="subtitles" src={file} srcLang="en" label="English" default />
);
} else {
return <source key={file} src={file} type={`video/${extension}`} />;
}
})}
{children}
</video>
);
};
export { Video };