-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
youtube and images can now have captions and tweaking inline code
- Loading branch information
1 parent
f4c8491
commit d285f67
Showing
7 changed files
with
63 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
undecided: | ||
- "@riverscapes/developer-site" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
import React from 'react' | ||
import { Box } from '@mui/material' | ||
import { Box, Stack, Typography } from '@mui/material' | ||
|
||
interface YoutubeEmbedProps { | ||
embedId: string | ||
caption?: string | ||
} | ||
|
||
export const YoutubeEmbed: React.FC<YoutubeEmbedProps> = ({ embedId }) => { | ||
export const YoutubeEmbed: React.FC<YoutubeEmbedProps> = ({ embedId, caption }) => { | ||
return ( | ||
<Box | ||
sx={{ | ||
overflow: 'hidden', | ||
pb: '56.25%', | ||
position: 'relative', | ||
height: 0, | ||
'&>iframe': { | ||
left: 0, | ||
top: 0, | ||
height: '100%', | ||
width: '100%', | ||
position: 'absolute', | ||
}, | ||
}} | ||
> | ||
<iframe | ||
width="853" | ||
height="480" | ||
src={`https://www.youtube.com/embed/${embedId}`} | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowFullScreen | ||
title="Embedded youtube" | ||
/> | ||
</Box> | ||
<Stack> | ||
<Box | ||
sx={{ | ||
overflow: 'hidden', | ||
pb: '56.25%', | ||
position: 'relative', | ||
height: 0, | ||
'&>iframe': { | ||
left: 0, | ||
top: 0, | ||
height: '100%', | ||
width: '100%', | ||
position: 'absolute', | ||
}, | ||
}} | ||
> | ||
<iframe | ||
width="853" | ||
height="480" | ||
src={`https://www.youtube.com/embed/${embedId}`} | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowFullScreen | ||
title="Embedded youtube" | ||
/> | ||
</Box> | ||
{caption && ( | ||
<Typography variant="caption" style={{ textAlign: 'center', width: '100%' }}> | ||
{caption} | ||
</Typography> | ||
)} | ||
</Stack> | ||
) | ||
} |