fix(docs): Fix SSR build errors by dynamically importing UI components and resolving other issues (#4991)
This commit is contained in:
1 parent
d59828ab22
commit
09ac43f297
6 files changed
+341
-348
No files matched your search
@@ -1,39 +1,45 @@
|
||||
// import React, { useState } from 'react';
|
||||
// import CinePlayer from '../../../../ui-next/src/components/CinePlayer/CinePlayer';
|
||||
// import ShowcaseRow from './ShowcaseRow';
|
||||
import React, { useState } from 'react';
|
||||
import useIsBrowser from '@docusaurus/useIsBrowser';
|
||||
import ShowcaseRow from './ShowcaseRow';
|
||||
|
||||
/**
|
||||
* CinePlayerShowcase displays a playable/pausable cine player with FPS control.
|
||||
*/
|
||||
export default function CinePlayerShowcase() {
|
||||
return null;
|
||||
}
|
||||
// const [isPlaying, setIsPlaying] = useState(false);
|
||||
// const [fps, setFps] = useState(24);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [fps, setFps] = useState(24);
|
||||
const isBrowser = useIsBrowser();
|
||||
|
||||
// return (
|
||||
// <ShowcaseRow
|
||||
// title="Cine Player"
|
||||
// description="Play, pause, scrub through dynamic image series and adjust FPS."
|
||||
// code={`
|
||||
// <CinePlayer
|
||||
// className="w-[300px]"
|
||||
// isPlaying={isPlaying}
|
||||
// frameRate={fps}
|
||||
// onPlayPauseChange={setIsPlaying}
|
||||
// onFrameRateChange={setFps}
|
||||
// onClose={() => console.log('close clicked')}
|
||||
// />
|
||||
// `}
|
||||
// >
|
||||
// <CinePlayer
|
||||
// className="w-[300px]"
|
||||
// isPlaying={isPlaying}
|
||||
// frameRate={fps}
|
||||
// onPlayPauseChange={setIsPlaying}
|
||||
// onFrameRateChange={setFps}
|
||||
// onClose={() => console.log('close clicked')}
|
||||
// />
|
||||
// </ShowcaseRow>
|
||||
// );
|
||||
// }
|
||||
// If not browser, return null to avoid SSR parse errors
|
||||
if (!isBrowser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { default: CinePlayer } = require('../../../../ui-next/src/components/CinePlayer/CinePlayer');
|
||||
|
||||
return (
|
||||
<ShowcaseRow
|
||||
title="Cine Player"
|
||||
description="Play, pause, scrub through dynamic image series and adjust FPS."
|
||||
code={`
|
||||
<CinePlayer
|
||||
className="w-[300px]"
|
||||
isPlaying={isPlaying}
|
||||
frameRate={fps}
|
||||
onPlayPauseChange={setIsPlaying}
|
||||
onFrameRateChange={setFps}
|
||||
onClose={() => console.log('close clicked')}
|
||||
/>
|
||||
`}
|
||||
>
|
||||
<CinePlayer
|
||||
className="w-[300px]"
|
||||
isPlaying={isPlaying}
|
||||
frameRate={fps}
|
||||
onPlayPauseChange={setIsPlaying}
|
||||
onFrameRateChange={setFps}
|
||||
onClose={() => console.log('close clicked')}
|
||||
/>
|
||||
</ShowcaseRow>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user