diff --git a/packages/react-notion-x/src/third-party/collection-view.tsx b/packages/react-notion-x/src/third-party/collection-view.tsx index 378550dc..761246b8 100644 --- a/packages/react-notion-x/src/third-party/collection-view.tsx +++ b/packages/react-notion-x/src/third-party/collection-view.tsx @@ -1,5 +1,6 @@ import React from 'react' +import { useNotionContext } from '../context' import { type CollectionViewProps } from '../types' import { CollectionViewBoard } from './collection-view-board' import { CollectionViewGallery } from './collection-view-gallery' @@ -8,18 +9,31 @@ import { CollectionViewTable } from './collection-view-table' export function CollectionViewImpl(props: CollectionViewProps) { const { collectionView } = props + const { components } = useNotionContext() switch (collectionView.type) { case 'table': + if (components.CollectionViewTable) { + return + } return case 'gallery': + if (components.CollectionViewGallery) { + return + } return case 'list': + if (components.CollectionViewList) { + return + } return case 'board': + if (components.CollectionViewBoard) { + return + } return default: diff --git a/packages/react-notion-x/src/types.ts b/packages/react-notion-x/src/types.ts index 4da775e1..1cc6132f 100644 --- a/packages/react-notion-x/src/types.ts +++ b/packages/react-notion-x/src/types.ts @@ -34,6 +34,12 @@ export interface NotionComponents { Collection: any Property?: any + // collection view components + CollectionViewGallery?: any + CollectionViewTable?: any + CollectionViewList?: any + CollectionViewBoard?: any + propertyTextValue: ComponentOverrideFn propertySelectValue: ComponentOverrideFn propertyRelationValue: ComponentOverrideFn