Files
nextjs-notion-starter-kit/components/PageAside.tsx
Travis Fischer 3a229e357c 🔞
2022-10-15 18:03:52 -04:00

31 lines
661 B
TypeScript

import * as React from 'react'
import { Block, ExtendedRecordMap } from 'notion-types'
import { getPageTweet } from '@/lib/get-page-tweet'
import { PageActions } from './PageActions'
import { PageSocial } from './PageSocial'
export const PageAside: React.FC<{
block: Block
recordMap: ExtendedRecordMap
isBlogPost: boolean
}> = ({ block, recordMap, isBlogPost }) => {
if (!block) {
return null
}
// only display comments and page actions on blog post pages
if (isBlogPost) {
const tweet = getPageTweet(block, recordMap)
if (!tweet) {
return null
}
return <PageActions tweet={tweet} />
}
return <PageSocial />
}