mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-13 15:09:47 +00:00
feat: revert to using official twitter embedding sdk; bump deps
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user