minor fixes
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { MediaOutlet, MediaPlayer } from '@vidstack/react';
|
||||
|
||||
export default function VideoPreview({ url }: { url: string }) {
|
||||
export default function VideoPreview({ url, size }: { url: string; size: string }) {
|
||||
return (
|
||||
<div onClick={(e) => e.stopPropagation()} className="relative mt-2 flex flex-col overflow-hidden rounded-lg">
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={`relative mt-2 flex flex-col overflow-hidden rounded-lg ${size === 'large' ? 'w-4/5' : 'w-2/3'}`}
|
||||
>
|
||||
<MediaPlayer src={url} poster="" controls>
|
||||
<MediaOutlet />
|
||||
</MediaPlayer>
|
||||
|
||||
@@ -5,11 +5,14 @@ function getVideoId(url: string) {
|
||||
return regex.exec(url)[3];
|
||||
}
|
||||
|
||||
export default function YoutubePreview({ url }: { url: string }) {
|
||||
export default function YoutubePreview({ url, size }: { url: string; size: string }) {
|
||||
const id = getVideoId(url);
|
||||
|
||||
return (
|
||||
<div onClick={(e) => e.stopPropagation()} className="relative mt-2 flex flex-col overflow-hidden rounded-lg">
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={`relative mt-2 flex flex-col overflow-hidden rounded-lg ${size === 'large' ? 'w-4/5' : 'w-2/3'}`}
|
||||
>
|
||||
<YouTube videoId={id} className="aspect-video xl:w-2/3" opts={{ width: '100%', height: '100%' }} />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user