-
Notifications
You must be signed in to change notification settings - Fork 316
feat(docs): embed Youtube videos in the docs #3323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| @use "@pythnetwork/component-library/theme"; | ||
|
|
||
| .container { | ||
| position: relative; | ||
| width: 100%; | ||
| padding-bottom: 56.25%; /* 16:9 aspect ratio */ | ||
| margin: theme.spacing(6) 0; | ||
| border-radius: theme.border-radius("xl"); | ||
| overflow: hidden; | ||
| background-color: theme.color("background", "primary"); | ||
| box-shadow: 0 4px 24px rgb(0 0 0 / 12%); | ||
| } | ||
|
|
||
| .iframe { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| border: none; | ||
| } | ||
|
Comment on lines
+1
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need a container here, stying iframe should be enough. You can remove all the iframe styles here and just copy paste the ones from |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import clsx from "clsx"; | ||
|
|
||
| import styles from "./index.module.scss"; | ||
|
|
||
| type YouTubeEmbedProps = { | ||
| id: string; | ||
| title?: string; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export const YouTubeEmbed = ({ | ||
| id, | ||
| title = "YouTube video player", | ||
| className, | ||
| }: YouTubeEmbedProps) => ( | ||
| <div className={clsx(styles.container, className)}> | ||
| <iframe | ||
| className={styles.iframe} | ||
| src={`https://www.youtube.com/embed/${id}`} | ||
| title={title} | ||
| allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
| referrerPolicy="strict-origin-when-cross-origin" | ||
| allowFullScreen | ||
| /> | ||
| </div> | ||
| ); | ||
|
|
||
| export default YouTubeEmbed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.