diff --git a/docusaurus.config.js b/docusaurus.config.js index 647eaac3..9aeafb14 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -118,23 +118,23 @@ const config = { alt: 'LunarVim Preview', }, ], + /** NOTE: max 3 preferred + * for playlists you need to pass playlistCoverId + * playlistCoverId = youtube video id + */ YouTube: [ - /* NOTE: max 3 preferred */ - /* type: video | playlist */ { - type: 'video', id: 'NPmKRygD7DU', title: 'Neovim v0.8 release', }, { - type: 'video', id: 'sFA9kX-Ud_c', title: 'Install LunarVim Stable Release', }, { - type: 'playlist', id: 'PLhoH5vyxr6QoYP4bKw0krF4aEn_3_pfWA', title: 'LunarVim (IDE for Neovim)', + playlistCoverId: 'NlRxRtGpHHk', }, ], Contributors: { diff --git a/package.json b/package.json index 1652e032..e8e9be39 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "react-contributors": "^1.1.2", "react-countup": "^6.4.0", "react-dom": "^17.0.2", + "react-lite-youtube-embed": "^2.3.52", "subset-font": "^1.6.1" }, "devDependencies": { diff --git a/src/components/YouTube/index.jsx b/src/components/YouTube/index.jsx index 910f8cad..0e15ec07 100644 --- a/src/components/YouTube/index.jsx +++ b/src/components/YouTube/index.jsx @@ -2,6 +2,9 @@ import React from 'react'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Clouds from '../Clouds'; import styles from './styles.module.css'; +import LiteYouTubeEmbed from 'react-lite-youtube-embed'; +import 'react-lite-youtube-embed/dist/LiteYouTubeEmbed.css'; +import './yt-lite.css' const YouTube = () => { const { @@ -16,18 +19,15 @@ const YouTube = () => { {YouTube.map((yt) => (

{yt.title}

- + playlistCoverId={yt.playlistCoverId} + playlist={yt.playlistCoverId} + playerClass="lty-playbtn" + />
))} diff --git a/src/components/YouTube/styles.module.css b/src/components/YouTube/styles.module.css index 9f53b225..507843e7 100644 --- a/src/components/YouTube/styles.module.css +++ b/src/components/YouTube/styles.module.css @@ -5,15 +5,6 @@ flex: 1; } -.yt > iframe { - border: 2px solid var(--primary-bg); - border-radius: 1rem; - aspect-ratio: 16/9; - height: auto; - width: 100%; - max-width: 100%; -} - .yt > h2 { text-align: center; } diff --git a/src/components/YouTube/yt-lite.css b/src/components/YouTube/yt-lite.css new file mode 100644 index 00000000..b28823c8 --- /dev/null +++ b/src/components/YouTube/yt-lite.css @@ -0,0 +1,20 @@ +.yt-lite { + border: 2px solid var(--primary-bg); + border-radius: 1rem; + aspect-ratio: 16/9; + height: auto; + width: 100%; + max-width: 100%; +} + +.yt-lite > .lty-playbtn { + border-color: transparent; +} + +.yt-lite > .lty-playbtn::before { + border-color: transparent transparent transparent #cdd6f4; +} + +.yt-lite:hover > .lty-playbtn { + border-color: transparent; +} diff --git a/yarn.lock b/yarn.lock index 8ede950d..7272d204 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6439,6 +6439,11 @@ react-lifecycles-compat@^3.0.4: resolved "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== +react-lite-youtube-embed@^2.3.52: + version "2.3.52" + resolved "https://registry.yarnpkg.com/react-lite-youtube-embed/-/react-lite-youtube-embed-2.3.52.tgz#7f8125a03e7a940745b63d11abd6821ffe1babe5" + integrity sha512-G010PvCavA4EqL8mZ/Sv9XXiHnjMfONW+lmNeCRnSEPluPdptv2lZ0cNlngrj7K9j7luc8pbpyrmNpKbD9VMmw== + react-loadable-ssr-addon-v5-slorber@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/react-loadable-ssr-addon-v5-slorber/-/react-loadable-ssr-addon-v5-slorber-1.0.1.tgz"