2023-12-29 23:09:30 +01:00
|
|
|
import { BasicHtmlStyles } from "components/content/BasicHtmlStyles"
|
2022-08-20 23:02:55 +02:00
|
|
|
import { ImageWithPlaceholderWhileLoading } from "components/ImageWithPlaceholderWhileLoading"
|
2022-08-13 10:56:07 +02:00
|
|
|
|
2022-11-08 11:50:09 +01:00
|
|
|
export function Enclosure(props: { enclosureType: string; enclosureUrl: string }) {
|
2024-02-19 20:32:20 +01:00
|
|
|
const hasVideo = props.enclosureType.startsWith("video")
|
|
|
|
|
const hasAudio = props.enclosureType.startsWith("audio")
|
|
|
|
|
const hasImage = props.enclosureType.startsWith("image")
|
2022-08-20 23:02:55 +02:00
|
|
|
|
2022-08-13 10:56:07 +02:00
|
|
|
return (
|
2023-12-29 23:09:30 +01:00
|
|
|
<BasicHtmlStyles>
|
2022-08-13 10:56:07 +02:00
|
|
|
{hasVideo && (
|
2024-02-10 21:50:17 +01:00
|
|
|
<video controls width="100%">
|
2022-08-13 10:56:07 +02:00
|
|
|
<source src={props.enclosureUrl} type={props.enclosureType} />
|
|
|
|
|
</video>
|
|
|
|
|
)}
|
|
|
|
|
{hasAudio && (
|
|
|
|
|
<audio controls>
|
|
|
|
|
<source src={props.enclosureUrl} type={props.enclosureType} />
|
|
|
|
|
</audio>
|
|
|
|
|
)}
|
2022-08-20 23:02:55 +02:00
|
|
|
{hasImage && <ImageWithPlaceholderWhileLoading src={props.enclosureUrl} alt="enclosure" />}
|
2023-12-29 23:09:30 +01:00
|
|
|
</BasicHtmlStyles>
|
2022-08-13 10:56:07 +02:00
|
|
|
)
|
|
|
|
|
}
|