Api Admin Menu Desa Sub Menu Layanan Tabs 3 Pelayanan Done
This commit is contained in:
33
src/app/admin/(dashboard)/desa/gallery/lib/youtubeEmbed.tsx
Normal file
33
src/app/admin/(dashboard)/desa/gallery/lib/youtubeEmbed.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
// components/YoutubeEmbed.tsx
|
||||
"use client";
|
||||
|
||||
import { Box, Text } from "@mantine/core";
|
||||
|
||||
type YoutubeEmbedProps = {
|
||||
url?: string;
|
||||
showRawUrl?: boolean; // opsional, buat nampilin URL mentahnya
|
||||
};
|
||||
|
||||
export default function YoutubeEmbed({ url, showRawUrl = false }: YoutubeEmbedProps) {
|
||||
if (!url || !url.includes("embed")) {
|
||||
return <Text c="red">Link embed Youtube tidak valid</Text>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Box
|
||||
component="iframe"
|
||||
src={url}
|
||||
width="100%"
|
||||
height={300}
|
||||
allowFullScreen
|
||||
style={{ borderRadius: 8 }}
|
||||
/>
|
||||
{showRawUrl && (
|
||||
<Text fz="sm" c="dimmed" mt={5}>
|
||||
{url}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user