diff --git a/src/components/FitVideo.tsx b/src/components/FitVideo.tsx new file mode 100644 index 0000000..1c55fcc --- /dev/null +++ b/src/components/FitVideo.tsx @@ -0,0 +1,29 @@ +import { createStyles, makeStyles } from '@material-ui/core' +import { ReactElement } from 'react' + +const useStyles = makeStyles(() => + createStyles({ + video: { + width: '100%', + height: '100%', + objectFit: 'cover', + }, + }), +) + +interface VideoProps { + src: string | undefined + maxHeight?: string + maxWidth?: string +} + +export function FitVideo(props: VideoProps): ReactElement { + const classes = useStyles() + + const inlineStyles: Record = {} + + props.maxHeight && (inlineStyles.maxHeight = props.maxHeight) + props.maxWidth && (inlineStyles.maxWidth = props.maxWidth) + + return