postiz-app/libraries/react-shared-libraries/src/helpers/video.or.image.tsx
2024-05-24 12:07:52 +07:00

15 lines
382 B
TypeScript

import { FC } from 'react';
export const VideoOrImage: FC<{ src: string; autoplay: boolean }> = (props) => {
const { src, autoplay } = props;
if (src.indexOf('mp4') > -1) {
return <video src={src} autoPlay={autoplay} className="w-full h-full" muted={true} loop={true} />;
}
return (
<img
className="w-full h-full object-cover"
src={src}
/>
);
};