Yuki Takei 3 лет назад
Родитель
Сommit
fd124f45fc

+ 2 - 9
packages/presentation/src/components/PresentationWithReveal.tsx

@@ -1,14 +1,12 @@
 import React, { useEffect } from 'react';
 
-import { ReactMarkdown } from 'react-markdown/lib/react-markdown';
 import type { ReactMarkdownOptions } from 'react-markdown/lib/react-markdown';
 import Reveal from 'reveal.js';
 
-import * as hrSplitter from '../services/renderer/hr-splitter';
-
 
 import 'reveal.js/dist/reveal.css';
 import 'reveal.js/dist/theme/black.css';
+import { Sections } from './Sections';
 
 
 type Props = {
@@ -28,15 +26,10 @@ export const Presentation = (props: Props): JSX.Element => {
     }
   }, [children, revealOptions]);
 
-  rendererOptions.remarkPlugins?.push(hrSplitter.remarkPlugin);
-
   return (
     <div className="reveal">
       <div className="slides">
-        { children == null
-          ? <section>No contents</section>
-          : <ReactMarkdown {...rendererOptions}>{children}</ReactMarkdown>
-        }
+        <Sections rendererOptions={rendererOptions}>{children}</Sections>
       </div>
     </div>
   );

+ 33 - 0
packages/presentation/src/components/Sections.tsx

@@ -0,0 +1,33 @@
+import React from 'react';
+
+// import { Marp } from '@marp-team/marp-core';
+import Head from 'next/head';
+import { ReactMarkdown } from 'react-markdown/lib/react-markdown';
+import type { ReactMarkdownOptions } from 'react-markdown/lib/react-markdown';
+
+import * as hrSplitter from '../services/renderer/hr-splitter';
+
+type SectionsProps = {
+  rendererOptions: ReactMarkdownOptions,
+  children?: string,
+}
+
+export const Sections = (props: SectionsProps): JSX.Element => {
+  const { rendererOptions, children } = props;
+
+  rendererOptions.remarkPlugins?.push(hrSplitter.remarkPlugin);
+
+  // const marp = new Marp();
+  // const { css } = marp.render('', { htmlAsArray: true });
+  return (
+    <>
+      <Head>
+        {/* <style>{css}</style> */}
+      </Head>
+      { children == null
+        ? <section>No contents</section>
+        : <ReactMarkdown {...rendererOptions}>{children}</ReactMarkdown>
+      }
+    </>
+  );
+};