From caa33e3d882939d99968582151c7f56ff6b8a7eb Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Thu, 28 Jan 2021 21:45:09 -0500 Subject: [PATCH] feat: use new dynamic react-notion-x components --- components/NotionPage.tsx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/components/NotionPage.tsx b/components/NotionPage.tsx index d439166..a6dc922 100644 --- a/components/NotionPage.tsx +++ b/components/NotionPage.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import Head from 'next/head' import Link from 'next/link' +import dynamic from 'next/dynamic' import cs from 'classnames' import { useRouter } from 'next/router' import { useLocalStorage, useSearchParam } from 'react-use' @@ -31,6 +32,27 @@ import { ReactUtterances } from './ReactUtterances' import styles from './styles.module.css' +const Code = dynamic(() => + import('react-notion-x').then((notion) => notion.Code) +) + +const Collection = dynamic(() => + import('react-notion-x').then((notion) => notion.Collection) +) + +const CollectionRow = dynamic(() => + import('react-notion-x').then((notion) => notion.CollectionRow) +) + +const Tweet = dynamic(() => + import('react-notion-x').then((notion) => notion.Tweet) +) + +const Modal = dynamic( + () => import('react-notion-x').then((notion) => notion.Modal), + { ssr: false } +) + export const NotionPage: React.FC = ({ site, recordMap, @@ -197,7 +219,12 @@ export const NotionPage: React.FC = ({ > - ) + ), + code: Code, + collection: Collection, + collectionRow: CollectionRow, + tweet: Tweet, + modal: Modal }} recordMap={recordMap} rootPageId={site.rootNotionPageId}