diff --git a/packages/notion-types/src/core.ts b/packages/notion-types/src/core.ts index fac587474..b3d7ba9e0 100644 --- a/packages/notion-types/src/core.ts +++ b/packages/notion-types/src/core.ts @@ -45,6 +45,7 @@ export type PropertyType = | 'select' | 'status' | 'multi_select' + | 'auto_increment_id' | 'date' | 'person' | 'file' diff --git a/packages/react-notion-x/src/context.tsx b/packages/react-notion-x/src/context.tsx index 63140538d..edfb838d2 100644 --- a/packages/react-notion-x/src/context.tsx +++ b/packages/react-notion-x/src/context.tsx @@ -131,6 +131,7 @@ const defaultComponents: NotionComponents = { propertyLastEditedTimeValue: dummyOverrideFn, propertyCreatedTimeValue: dummyOverrideFn, propertyDateValue: dummyOverrideFn, + propertyAutoIncrementIdValue: dummyOverrideFn, Pdf: dummyComponent('Pdf'), Tweet: dummyComponent('Tweet'), diff --git a/packages/react-notion-x/src/icons/property-icon.tsx b/packages/react-notion-x/src/icons/property-icon.tsx index 2e3981a3d..07428475e 100644 --- a/packages/react-notion-x/src/icons/property-icon.tsx +++ b/packages/react-notion-x/src/icons/property-icon.tsx @@ -2,6 +2,7 @@ import * as React from 'react' import { PropertyType } from 'notion-types' +import AutoIncrementIdIcon from './type-auto-increment-id' import CheckboxIcon from './type-checkbox' import DateIcon from './type-date' import EmailIcon from './type-email' @@ -44,7 +45,8 @@ const iconMap = { created_time: TimestampIcon, last_edited_time: TimestampIcon, created_by: Person2Icon, - last_edited_by: Person2Icon + last_edited_by: Person2Icon, + auto_increment_id: AutoIncrementIdIcon } export const PropertyIcon: React.FC = ({ diff --git a/packages/react-notion-x/src/icons/type-auto-increment-id.svg b/packages/react-notion-x/src/icons/type-auto-increment-id.svg new file mode 100644 index 000000000..ac3433215 --- /dev/null +++ b/packages/react-notion-x/src/icons/type-auto-increment-id.svg @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/packages/react-notion-x/src/icons/type-auto-increment-id.tsx b/packages/react-notion-x/src/icons/type-auto-increment-id.tsx new file mode 100644 index 000000000..82653a4e8 --- /dev/null +++ b/packages/react-notion-x/src/icons/type-auto-increment-id.tsx @@ -0,0 +1,11 @@ +import * as React from 'react' + +function SvgTypeAutoIncrementId(props: React.SVGProps) { + return ( + + + + ) +} + +export default SvgTypeAutoIncrementId diff --git a/packages/react-notion-x/src/styles.css b/packages/react-notion-x/src/styles.css index 184e8b3f0..d380401d4 100644 --- a/packages/react-notion-x/src/styles.css +++ b/packages/react-notion-x/src/styles.css @@ -10,6 +10,7 @@ --fg-color-4: #000; --fg-color-5: rgba(55, 53, 47, 0.024); --fg-color-6: rgba(55, 53, 47, 0.8); + --fg-color-7: rgba(55, 53, 47, 0.5); --fg-color-icon: var(--fg-color); --bg-color: #fff; @@ -1409,6 +1410,10 @@ svg.notion-page-icon { padding: 7px 8px 0; } +.notion-table-cell-auto_increment_id { + color: var(--fg-color-7); +} + .notion-property-select, .notion-property-status, .notion-property-multi_select { @@ -2158,6 +2163,10 @@ svg.notion-page-icon { width: 100%; } +.notion-collection-row-property .notion-property-auto_increment_id { + color: var(--fg-color-7); +} + .notion-collection-row-property .notion-collection-column-title-icon { width: 16px; height: 16px; diff --git a/packages/react-notion-x/src/third-party/property.tsx b/packages/react-notion-x/src/third-party/property.tsx index 5ef8f6fa2..1d520570b 100644 --- a/packages/react-notion-x/src/third-party/property.tsx +++ b/packages/react-notion-x/src/third-party/property.tsx @@ -276,6 +276,14 @@ export const PropertyImpl: React.FC = (props) => { [block, data, schema] ) + const renderAutoIncrementIdValue = React.useMemo( + () => + function renderAutoIncrementIdValueProperty() { + return + }, + [block, data] + ) + const renderCreatedTimeValue = React.useMemo( () => function CreatedTimeProperty() { @@ -456,6 +464,12 @@ export const PropertyImpl: React.FC = (props) => { // console.log('last_edited_by', schema, data) break + case 'auto_increment_id': + content = components.propertyTextValue( + props, + renderAutoIncrementIdValue + ) + break case 'text': content = components.propertyTextValue(props, renderTextValue) break diff --git a/packages/react-notion-x/src/types.ts b/packages/react-notion-x/src/types.ts index 9eec16c9d..f6f7a0dea 100644 --- a/packages/react-notion-x/src/types.ts +++ b/packages/react-notion-x/src/types.ts @@ -47,6 +47,7 @@ export interface NotionComponents { propertyLastEditedTimeValue: ComponentOverrideFn propertyCreatedTimeValue: ComponentOverrideFn propertyDateValue: ComponentOverrideFn + propertyAutoIncrementIdValue: ComponentOverrideFn // assets Pdf: any