SlideViewer.tsx 829 B

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react';
  2. import dynamic from 'next/dynamic';
  3. import { ReactMarkdownOptions } from 'react-markdown/lib/react-markdown';
  4. import { usePresentationViewOptions } from '~/stores/slide-viewer-renderer';
  5. const Slides = dynamic(() => import('../Presentation/Slides').then(mod => mod.Slides), { ssr: false });
  6. type SlideViewerProps = {
  7. marp: string | undefined,
  8. children: string,
  9. }
  10. export const SlideViewer: React.FC<SlideViewerProps> = React.memo((props: SlideViewerProps) => {
  11. const {
  12. marp, children,
  13. } = props;
  14. const { data: rendererOptions } = usePresentationViewOptions();
  15. return (
  16. <Slides
  17. hasMarpFlag={marp != null}
  18. options={{ rendererOptions: rendererOptions as ReactMarkdownOptions }}
  19. >
  20. {children}
  21. </Slides>
  22. );
  23. });
  24. SlideViewer.displayName = 'SlideViewer';