1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 07:21:17 -04:00

clean up <Video /> props

This commit is contained in:
2022-02-16 11:10:09 -05:00
parent 3bc3e1b5a1
commit 3edaa6b0e4
10 changed files with 52 additions and 29 deletions

View File

@@ -5,22 +5,25 @@ import type { FilePlayerProps } from "react-player/file";
import styles from "./Video.module.css";
export type VideoProps = Partial<FilePlayerProps> & {
webm?: string;
mp4?: string;
src: {
// at least one is required:
webm?: string;
mp4?: string;
};
thumbnail?: string;
subs?: string;
autoplay?: boolean;
className?: string;
};
const Video = ({ webm, mp4, thumbnail, subs, autoplay, className, ...rest }: VideoProps) => {
const Video = ({ src, thumbnail, subs, autoplay, className, ...rest }: VideoProps) => {
const url = [
webm && {
src: webm,
src.webm && {
src: src.webm,
type: "video/webm",
},
mp4 && {
src: mp4,
src.mp4 && {
src: src.mp4,
type: "video/mp4",
},
];