🎥 Make videos programmatically with React
hmm
Jonny Burger1c91b1725568
diff --git a/packages/docs/src/components/VideoPlayerHeader.tsx b/packages/docs/src/components/VideoPlayerHeader.tsxindex b8627681bb..9a6782cbd1 100644--- a/packages/docs/src/components/VideoPlayerHeader.tsx+++ b/packages/docs/src/components/VideoPlayerHeader.tsx@@ -50,11 +50,7 @@ const VideoPlayerHeader: React.ForwardRefRenderFunction<}> = ({onDismiss, onNext, onPrevious, hasNext, hasPrevious}, ref) => {return (- <div- ref={ref}- style={container}- className="video-player-header"- >+ <div ref={ref} style={container} className="video-player-header"><button onClick={onDismiss} type="button" style={button}><CancelIcon style={iconStyle} className="video-player-icon" /></button>diff --git a/packages/docs/src/pages/index.tsx b/packages/docs/src/pages/index.tsxindex e2f81a6cdb..476731d78b 100644--- a/packages/docs/src/pages/index.tsx+++ b/packages/docs/src/pages/index.tsx@@ -18,7 +18,10 @@ const Inner: React.FC = () => {useEffect(() => {// After hydration, determine the actual color mode from DOM attributesconst htmlElement = document.documentElement;- const currentTheme = htmlElement.getAttribute('data-theme') as 'light' | 'dark' | null;+ const currentTheme = htmlElement.getAttribute('data-theme') as+ | 'light'+ | 'dark'+ | null;if (currentTheme) {setColorModeState(currentTheme);}@@ -26,8 +29,13 @@ const Inner: React.FC = () => {// Set up a MutationObserver to watch for theme changesconst observer = new MutationObserver((mutations) => {mutations.forEach((mutation) => {- if (mutation.type === 'attributes' && mutation.attributeName === 'data-theme') {- const newTheme = (mutation.target as HTMLElement).getAttribute('data-theme') as 'light' | 'dark' | null;+ if (+ mutation.type === 'attributes' &&+ mutation.attributeName === 'data-theme'+ ) {+ const newTheme = (mutation.target as HTMLElement).getAttribute(+ 'data-theme',+ ) as 'light' | 'dark' | null;if (newTheme) {setColorModeState(newTheme);}@@ -37,7 +45,7 @@ const Inner: React.FC = () => {observer.observe(htmlElement, {attributes: true,- attributeFilter: ['data-theme']+ attributeFilter: ['data-theme'],});return () => observer.disconnect();@@ -46,12 +54,14 @@ const Inner: React.FC = () => {const handleSetColorMode = (newColorMode: 'light' | 'dark') => {// Dispatch a custom event to trigger Docusaurus theme changeconst event = new CustomEvent('docusaurus-theme-change', {- detail: { theme: newColorMode }+ detail: {theme: newColorMode},});window.dispatchEvent(event);-+// Also try to find and click the actual theme toggle button- const themeToggle = document.querySelector('[title="Switch between dark and light mode"]') as HTMLButtonElement;+ const themeToggle = document.querySelector(+ '[title="Switch between dark and light mode"]',+ ) as HTMLButtonElement;if (themeToggle && colorMode !== newColorMode) {themeToggle.click();}