feat: revert to using official twitter embedding sdk; bump deps

This commit is contained in:
Travis Fischer
2022-04-19 21:24:55 -04:00
parent aed9b2037d
commit 8163ce123d
8 changed files with 27 additions and 852 deletions

View File

@@ -9,7 +9,7 @@ import BodyClassName from 'react-body-classname'
import { useTheme } from 'next-themes'
import { PageBlock } from 'notion-types'
import { Tweet, TwitterContextProvider } from 'react-static-tweets'
import TweetEmbed from 'react-tweet-embed'
// core notion renderer
import { NotionRenderer } from 'react-notion-x'
@@ -104,6 +104,10 @@ const Modal = dynamic(
}
)
const Tweet = ({ id }: { id: string }) => {
return <TweetEmbed tweetId={id} />
}
const propertyLastEditedTimeValue = (
{ block, pageHeader },
defaultFn: () => React.ReactNode
@@ -172,20 +176,6 @@ export const NotionPage: React.FC<types.PageProps> = ({
[]
)
const twitterContextValue = React.useMemo(() => {
if (!recordMap) {
return null
}
return {
tweetAstMap: (recordMap as any).tweetAstMap || {},
swrOptions: {
fetcher: (id: string) =>
fetch(`/api/get-tweet-ast/${id}`).then((r) => r.json())
}
}
}, [recordMap])
// lite mode is for oembed
const isLiteMode = lite === 'true'
@@ -262,7 +252,7 @@ export const NotionPage: React.FC<types.PageProps> = ({
}
return (
<TwitterContextProvider value={twitterContextValue}>
<>
<PageHead
pageId={pageId}
site={site}
@@ -300,6 +290,6 @@ export const NotionPage: React.FC<types.PageProps> = ({
/>
<GitHubShareButton />
</TwitterContextProvider>
</>
)
}