RichSlideSection.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. const RichSlideSectionNoMemorized = (props: RichSlideSectionProps): JSX.Element => {
  22. const { children } = props;
  23. return (
  24. <OriginalRichSlideSection>
  25. {children}
  26. </OriginalRichSlideSection>
  27. );
  28. };
  29. export const RichSlideSection = React.memo(RichSlideSectionNoMemorized) as typeof RichSlideSectionNoMemorized;
  30. const PresentationRichSlideSectionNoMemorized = (props: RichSlideSectionProps): JSX.Element => {
  31. const { children } = props;
  32. return (
  33. <OriginalRichSlideSection presentation>
  34. {children}
  35. </OriginalRichSlideSection>
  36. );
  37. };
  38. export const PresentationRichSlideSection = React.memo(PresentationRichSlideSectionNoMemorized) as typeof PresentationRichSlideSectionNoMemorized;