import type { CSSProperties } from 'react'; import { useSlidesByFrontmatter } from '@growi/presentation/dist/services'; import type { RendererOptions } from '~/interfaces/renderer-options'; import { useIsEnabledMarp } from '~/stores/context'; import RevisionRenderer from '../../components-universal/PageView/RevisionRenderer'; import { SlideRenderer } from '../Page/SlideRenderer'; import styles from './Preview.module.scss'; const moduleClass = styles['page-editor-preview-body'] ?? ''; type Props = { rendererOptions: RendererOptions, markdown?: string, pagePath?: string | null, expandContentWidth?: boolean, style?: CSSProperties, onScroll?: (scrollTop: number) => void, } const Preview = (props: Props): JSX.Element => { const { rendererOptions, markdown, pagePath, style, expandContentWidth, } = props; const { data: isEnabledMarp } = useIsEnabledMarp(); const isSlide = useSlidesByFrontmatter(markdown, isEnabledMarp); const fluidLayoutClass = expandContentWidth ? 'fluid-layout' : ''; return (