Created
November 30, 2022 00:56
-
-
Save sibelius/af24052edf88c3c824d0627d9248699a to your computer and use it in GitHub Desktop.
Embed Browser Only for docusuarus
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
import React from 'react'; | |
import BrowserOnly from '@docusaurus/BrowserOnly'; | |
import { useColorMode } from '@docusaurus/theme-common'; | |
const Embed = (props) => { | |
const { isDarkTheme } = useColorMode(); | |
return ( | |
<BrowserOnly> | |
{() => { | |
const EmbedComponent = require('react-embed').default; | |
return <EmbedComponent isDark={isDarkTheme} {...props} />; | |
}} | |
</BrowserOnly> | |
); | |
}; | |
export default Embed; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment