Skip to content

Commit

Permalink
fix(website): use react-lite-youtube-embed for lazy YouTube video (#7390
Browse files Browse the repository at this point in the history
)

* fix(website): use react-lite-youtube-embed for lazy YouTube video

* fix(website): use react-lite-youtube-embed for lazy YouTube video

* fix(website): use react-lite-youtube-embed for lazy YouTube video

* Update multiple-sidebars.md

* Update installation.md

* refactor intro

* rename file back

Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
matkoch and Josh-Cena authored May 12, 2022
1 parent cd0aff4 commit fa10d1b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 30 deletions.
4 changes: 4 additions & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ atrule
autoconverted
autogen
autogenerating
autohide
backport
backticks
bartosz
Expand Down Expand Up @@ -152,6 +153,7 @@ marcey
marocchino
massoud
mathjax
maxresdefault
mdast
mdxa
mdxast
Expand Down Expand Up @@ -208,6 +210,7 @@ philpl
photoshop
picocolors
picomatch
playbtn
pluggable
plushie
pnpm
Expand Down Expand Up @@ -267,6 +270,7 @@ sensical
serializers
setaf
setext
showinfo
sida
simen
slorber
Expand Down
16 changes: 10 additions & 6 deletions website/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ Or read the **[5-minute tutorial](https://tutorial.docusaurus.io)** online.

In this presentation at [Algolia Community Event](https://www.algolia.com/), [Meta Open Source team](https://opensource.facebook.com/) shared a brief walk-through of Docusaurus. They covered how to get started with the project, enable plugins, and set up functionalities like documentation and blogging.

```mdx-code-block
import LiteYouTubeEmbed from 'react-lite-youtube-embed';
<div className="video-container">
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/Yhyx7otSksg"
<LiteYouTubeEmbed
// cSpell:ignore Yhyx Sksg
id="Yhyx7otSksg"
params="autoplay=1&autohide=1&showinfo=0&rel=0"
title="Docusaurus: Documentation Made Easy"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
poster="maxresdefault"
webp
/>
</div>
```

## Disclaimer {#disclaimer}

Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-lite-youtube-embed": "^2.2.2",
"react-medium-image-zoom": "^4.3.7",
"react-popper": "^2.3.0",
"rehype-katex": "^6.0.2",
Expand Down
28 changes: 11 additions & 17 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,17 @@ div[class^='announcementBar_'] {
content: 'site-custom-css-unique-rule';
}

@media only screen and (max-width: 996px) {
.video-container {
position: relative;
overflow: hidden;
width: 100%;
max-width: 560px;
margin: 0 auto;
padding-top: 56.25%;
}

.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-container {
position: relative;
overflow: hidden;
width: 100%;
max-width: 560px;
margin: 0 auto;
}

.yt-lite > .lty-playbtn {
cursor: pointer;
border: 0;
}

.dropdown-separator {
Expand Down
14 changes: 7 additions & 7 deletions website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import Tweet from '@site/src/components/Tweet';
import Tweets, {type TweetItem} from '@site/src/data/tweets';
import Quotes from '@site/src/data/quotes';
import Features, {type FeatureItem} from '@site/src/data/features';
import LiteYouTubeEmbed from 'react-lite-youtube-embed';
import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css';

import clsx from 'clsx';

Expand Down Expand Up @@ -162,14 +164,12 @@ function VideoContainer() {
<Translate>Check it out in the intro video</Translate>
</h2>
<div className="video-container">
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/_An9EsKPhp0"
<LiteYouTubeEmbed
id="_An9EsKPhp0"
params="autoplay=1&autohide=1&showinfo=0&rel=0"
title="Explain Like I'm 5: Docusaurus"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
loading="lazy"
poster="maxresdefault"
webp
/>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12522,6 +12522,11 @@ react-lifecycles-compat@^3.0.4:
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==

react-lite-youtube-embed@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/react-lite-youtube-embed/-/react-lite-youtube-embed-2.2.2.tgz#d61fce061ef730ac74072b82eb910021b8a9a7d1"
integrity sha512-1NqbNDcunRcB/9G9upXM59jyLdEUXy3Xk/XJ+JdIdT04qNTj5Xi8enR1BzMdowLsrDv8yW5qge2ob3gb22Qfnw==

[email protected]:
version "2.2.3"
resolved "https://registry.yarnpkg.com/react-live/-/react-live-2.2.3.tgz#260f99194213799f0005e473e7a4154c699d6a7c"
Expand Down

0 comments on commit fa10d1b

Please sign in to comment.