mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-04 04:25:28 +00:00
feat: add Video components
This commit is contained in:
24
src/components/OdyseeVideo.tsx
Normal file
24
src/components/OdyseeVideo.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import cx from 'classnames';
|
||||||
|
|
||||||
|
import type { FunctionalComponent } from 'preact';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
class?: string;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const OdyseeVideo: FunctionalComponent<Props> = ({ class: className, id, ...props }) => {
|
||||||
|
const classes = cx('relative aspect-video mbe-10', className);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class={classes} {...props}>
|
||||||
|
<iframe
|
||||||
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||||
|
allowFullScreen
|
||||||
|
class="absolute h-full w-full"
|
||||||
|
frameBorder="0"
|
||||||
|
src={`https://odysee.com/$/embed/${id}`}
|
||||||
|
></iframe>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
24
src/components/YouTubeVideo.tsx
Normal file
24
src/components/YouTubeVideo.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import cx from 'classnames';
|
||||||
|
|
||||||
|
import type { FunctionalComponent } from 'preact';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
class?: string;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const YouTubeVideo: FunctionalComponent<Props> = ({ class: className, id, ...props }) => {
|
||||||
|
const classes = cx('relative aspect-video mbe-10', className);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class={classes} {...props}>
|
||||||
|
<iframe
|
||||||
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||||
|
allowFullScreen
|
||||||
|
class="absolute h-full w-full"
|
||||||
|
frameBorder="0"
|
||||||
|
src={`https://www.youtube.com/embed/${id}`}
|
||||||
|
></iframe>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -11,6 +11,7 @@ export * from './LegalDate';
|
|||||||
export * from './Link';
|
export * from './Link';
|
||||||
export * from './ListItem';
|
export * from './ListItem';
|
||||||
export * from './NetflixFlag';
|
export * from './NetflixFlag';
|
||||||
|
export * from './OdyseeVideo';
|
||||||
export * from './OrderedList';
|
export * from './OrderedList';
|
||||||
export * from './PrimeVideoFlag';
|
export * from './PrimeVideoFlag';
|
||||||
export * from './Subheadline';
|
export * from './Subheadline';
|
||||||
@@ -20,3 +21,4 @@ export * from './TextLink';
|
|||||||
export * from './Title';
|
export * from './Title';
|
||||||
export * from './UnorderedList';
|
export * from './UnorderedList';
|
||||||
export * from './Verse';
|
export * from './Verse';
|
||||||
|
export * from './YouTubeVideo';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
AffiliateLink,
|
AffiliateLink,
|
||||||
AmazonBook,
|
AmazonBook,
|
||||||
|
Banner,
|
||||||
Book,
|
Book,
|
||||||
ColorSwatch,
|
ColorSwatch,
|
||||||
Divider,
|
Divider,
|
||||||
@@ -9,6 +10,7 @@ import {
|
|||||||
Image,
|
Image,
|
||||||
ListItem,
|
ListItem,
|
||||||
NetflixFlag,
|
NetflixFlag,
|
||||||
|
OdyseeVideo,
|
||||||
OrderedList,
|
OrderedList,
|
||||||
PrimeVideoFlag,
|
PrimeVideoFlag,
|
||||||
Subheadline,
|
Subheadline,
|
||||||
@@ -18,6 +20,7 @@ import {
|
|||||||
Title,
|
Title,
|
||||||
UnorderedList,
|
UnorderedList,
|
||||||
Verse,
|
Verse,
|
||||||
|
YouTubeVideo,
|
||||||
} from './components';
|
} from './components';
|
||||||
|
|
||||||
export const mapping = {
|
export const mapping = {
|
||||||
@@ -39,8 +42,10 @@ export const mapping = {
|
|||||||
li: ListItem,
|
li: ListItem,
|
||||||
ol: OrderedList,
|
ol: OrderedList,
|
||||||
NetflixFlag,
|
NetflixFlag,
|
||||||
|
OdyseeVideo,
|
||||||
p: Text,
|
p: Text,
|
||||||
ul: UnorderedList,
|
ul: UnorderedList,
|
||||||
PrimeVideoFlag,
|
PrimeVideoFlag,
|
||||||
Verse,
|
Verse,
|
||||||
|
YouTubeVideo,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user