RichSlideSection.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type { ReactNode } from 'react';
  2. import React from 'react';
  3. type RichSlideSectionProps = {
  4. children?: ReactNode,
  5. presentation?: boolean,
  6. }
  7. const OriginalRichSlideSection = React.memo((props: RichSlideSectionProps): JSX.Element => {
  8. const { children, presentation } = props;
  9. return (
  10. <section className={presentation ? 'm-2' : 'shadow rounded m-2'}>
  11. <svg data-marpit-svg="" viewBox="0 0 1280 720">
  12. <foreignObject width="1280" height="720">
  13. <section>
  14. {children ?? <></>}
  15. </section>
  16. </foreignObject>
  17. </svg>
  18. </section>
  19. );
  20. });
  21. export const RichSlideSection = (props: RichSlideSectionProps): JSX.Element => {
  22. const { children } = props;
  23. return (
  24. <OriginalRichSlideSection>
  25. {children}
  26. </OriginalRichSlideSection>
  27. );
  28. };
  29. export const PresentationRichSlideSection = (props: RichSlideSectionProps): JSX.Element => {
  30. const { children } = props;
  31. return (
  32. <OriginalRichSlideSection presentation>
  33. {children}
  34. </OriginalRichSlideSection>
  35. );
  36. };