Skip to content

Commit 3aa300c

Browse files
feat: halloween shenanigans
1 parent 47fb259 commit 3aa300c

File tree

21 files changed

+33
-54
lines changed

21 files changed

+33
-54
lines changed

examples/full/components/Loading.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type * as React from 'react'
2-
31
import { LoadingIcon } from './LoadingIcon'
42
import styles from './styles.module.css'
53

6-
export const Loading: React.FC = () => (
7-
<div className={styles.container}>
8-
<LoadingIcon />
9-
</div>
10-
)
4+
export function Loading() {
5+
return (
6+
<div className={styles.container}>
7+
<LoadingIcon />
8+
</div>
9+
)
10+
}

examples/full/components/LoadingIcon.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import cs from 'classnames'
2-
import * as React from 'react'
32

43
import styles from './styles.module.css'
54

6-
export const LoadingIcon = (props: any) => {
5+
export function LoadingIcon(props: any) {
76
const { className, ...rest } = props
87
return (
98
<svg

examples/full/components/NotionPage.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Link from 'next/link'
55
import { useRouter } from 'next/router'
66
import { type ExtendedRecordMap } from 'notion-types'
77
import { getPageTitle } from 'notion-utils'
8-
import * as React from 'react'
98
import { NotionRenderer } from 'react-notion-x'
109
import TweetEmbed from 'react-tweet-embed'
1110

@@ -75,11 +74,11 @@ const Modal = dynamic(
7574
}
7675
)
7776

78-
const Tweet = ({ id }: { id: string }) => {
77+
function Tweet({ id }: { id: string }) {
7978
return <TweetEmbed tweetId={id} />
8079
}
8180

82-
export const NotionPage = ({
81+
export function NotionPage({
8382
recordMap,
8483
previewImagesEnabled,
8584
rootPageId,
@@ -89,7 +88,7 @@ export const NotionPage = ({
8988
previewImagesEnabled?: boolean
9089
rootPageId?: string
9190
rootDomain?: string
92-
}) => {
91+
}) {
9392
const router = useRouter()
9493

9594
if (router.isFallback) {

examples/full/lib/notion.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ export async function getPage(pageId: string): Promise<ExtendedRecordMap> {
3232
}
3333

3434
export async function search(params: SearchParams): Promise<SearchResults> {
35-
return notion.search(params)
35+
if ('search' in notion) {
36+
return notion.search(params)
37+
} else {
38+
throw new Error('Notion API does not support search')
39+
}
3640
}

examples/full/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
"next": "^15.0.2",
2020
"notion-client": "workspace:*",
2121
"notion-compat": "workspace:*",
22-
"notion-utils": "workspace:*",
2322
"notion-types": "workspace:*",
23+
"notion-utils": "workspace:*",
2424
"p-map": "^7.0.2",
2525
"p-memoize": "^7.1.1",
26+
"prismjs": "^1.27.0",
2627
"react": "^18.3.1",
2728
"react-dom": "^18.3.1",
2829
"react-notion-x": "workspace:*",

examples/full/pages/[pageId].tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { type ExtendedRecordMap } from 'notion-types'
22
import { getAllPagesInSpace } from 'notion-utils'
3-
import * as React from 'react'
43
import { defaultMapPageUrl } from 'react-notion-x'
54

65
import { NotionPage } from '../components/NotionPage'

examples/full/pages/_app.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import 'katex/dist/katex.min.css'
44
import 'prismjs/themes/prism-tomorrow.css'
55
// core styles shared by all of react-notion-x (required)
66
import 'react-notion-x/src/styles.css'
7-
// force push
7+
// app styles
88
import '../styles/globals.css'
99

10-
import * as React from 'react'
11-
1210
function MyApp({ Component, pageProps }) {
1311
return <Component {...pageProps} />
1412
}

examples/full/pages/_document.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Document, { Head, Html, Main, NextScript } from 'next/document'
2-
import * as React from 'react'
32

43
export default class MyDocument extends Document {
54
render() {

examples/full/pages/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type ExtendedRecordMap } from 'notion-types'
2-
import * as React from 'react'
32

43
import { NotionPage } from '../components/NotionPage'
54
import {

examples/full/tsconfig.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
22
"compilerOptions": {
3-
"target": "es2016",
4-
"lib": ["dom", "esnext"],
5-
"allowJs": false,
3+
"target": "ES2017",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
66
"skipLibCheck": true,
77
"strict": false,
88
"forceConsistentCasingInFileNames": true,
9-
"experimentalDecorators": true,
109
"noEmit": true,
1110
"esModuleInterop": true,
1211
"module": "esnext",
13-
"moduleResolution": "node",
12+
"moduleResolution": "bundler",
1413
"resolveJsonModule": true,
1514
"isolatedModules": true,
1615
"jsx": "preserve",

examples/minimal/components/NotionPage.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import Head from 'next/head'
22
import { type ExtendedRecordMap } from 'notion-types'
33
import { getPageTitle } from 'notion-utils'
4-
import * as React from 'react'
54
import { NotionRenderer } from 'react-notion-x'
65

7-
export const NotionPage = ({
6+
export function NotionPage({
87
recordMap,
98
rootPageId
109
}: {
1110
recordMap: ExtendedRecordMap
1211
rootPageId?: string
13-
}) => {
12+
}) {
1413
if (!recordMap) {
1514
return null
1615
}

examples/minimal/pages/[pageId].tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type ExtendedRecordMap } from 'notion-types'
2-
import * as React from 'react'
32

43
import { NotionPage } from '../components/NotionPage'
54
import { rootNotionPageId } from '../lib/config'

examples/minimal/pages/_app.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import 'react-notion-x/src/styles.css'
33
import '../styles/globals.css'
44

5-
import * as React from 'react'
6-
75
// used for code syntax highlighting (optional)
86
// import 'prismjs/themes/prism-tomorrow.css'
97

examples/minimal/pages/_document.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Document, { Head, Html, Main, NextScript } from 'next/document'
2-
import * as React from 'react'
32

43
export default class MyDocument extends Document {
54
render() {

examples/minimal/pages/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type ExtendedRecordMap } from 'notion-types'
2-
import * as React from 'react'
32

43
import { NotionPage } from '../components/NotionPage'
54
import { rootNotionPageId } from '../lib/config'

packages/react-notion-x/src/block.tsx

-16
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ const tocIndentLevelCache: {
5454
const pageCoverStyleCache: Record<string, object> = {}
5555

5656
export function Block(props: BlockProps) {
57-
console.log('Block', {
58-
id: props.block.id,
59-
type: props.block.type,
60-
level: props.level
61-
})
62-
6357
const ctx = useNotionContext()
6458
const {
6559
components,
@@ -154,16 +148,6 @@ export function Block(props: BlockProps) {
154148
const hasAside = !!((hasToc || pageAside) && !page_full_width)
155149
const hasPageCover = !!(pageCover || page_cover)
156150

157-
console.log({
158-
disableHeader,
159-
header,
160-
pageCover,
161-
pageHeader,
162-
pageFooter,
163-
footer,
164-
components
165-
})
166-
167151
return (
168152
<div
169153
className={cs(

packages/react-notion-x/src/components/text.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ export function Text({
249249
const externalObjectInstance = recordMap.block[blockId]
250250
?.value as ExternalObjectInstance
251251

252-
console.log('eoi', blockId, externalObjectInstance)
253252
return <EOI block={externalObjectInstance} inline={true} />
254253
}
255254

packages/react-notion-x/src/context.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ export function NotionContextProvider({
233233
[mapImageUrl, mapPageUrl, wrappedThemeComponents, rootPageId, rest]
234234
)
235235

236-
console.log('NotionContextProvider', { value })
237-
console.log({ rest, defaultComponents, wrappedThemeComponents })
238-
239236
return <ctx.Provider value={value}>{children}</ctx.Provider>
240237
}
241238

packages/react-notion-x/src/styles.css

+2
Original file line numberDiff line numberDiff line change
@@ -2251,6 +2251,8 @@ svg.notion-page-icon {
22512251

22522252
.lazy-image-wrapper img {
22532253
position: absolute;
2254+
top: 0;
2255+
left: 0;
22542256
width: 100%;
22552257
height: 100%;
22562258
object-fit: cover;

packages/react-notion-x/src/third-party/code.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// eslint-disable-next-line import/no-duplicates
2+
import 'prismjs'
13
import 'prismjs/components/prism-clike.min.js'
24
import 'prismjs/components/prism-css-extras.min.js'
35
import 'prismjs/components/prism-css.min.js'
@@ -11,6 +13,7 @@ import 'prismjs/components/prism-typescript.min.js'
1113
import copyToClipboard from 'clipboard-copy'
1214
import { type CodeBlock } from 'notion-types'
1315
import { getBlockTitle } from 'notion-utils'
16+
// eslint-disable-next-line import/no-duplicates, no-duplicate-imports
1417
import { highlightElement } from 'prismjs'
1518
import * as React from 'react'
1619

pnpm-lock.yaml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)