1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-19 12:15:27 -04:00

Tailwind redesign (#2387)

This commit is contained in:
2025-05-02 22:04:26 -04:00
committed by GitHub
parent c4f67f170b
commit 5058382f71
162 changed files with 2739 additions and 3554 deletions
+45
View File
@@ -0,0 +1,45 @@
import { cn } from "@/lib/utils";
import type { ComponentPropsWithoutRef } from "react";
export type VideoProps = Omit<Partial<ComponentPropsWithoutRef<"video">>, "src"> & {
src: string | string[] | undefined;
};
const Video = ({ src, autoPlay, className, children, ...rest }: VideoProps) => {
return (
<video
{...(typeof src === "string" ? { src } : {})}
{...(autoPlay
? {
preload: "auto",
controls: false,
autoPlay: true,
playsInline: true, // safari autoplay workaround
loop: true,
muted: true,
}
: {
preload: "metadata",
controls: 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 default Video;