Skip to content

Commit dc97691

Browse files
Merge pull request #508 from jjh2613/master
2 parents 4c98c80 + f302db4 commit dc97691

File tree

8 files changed

+51
-1
lines changed

8 files changed

+51
-1
lines changed

packages/notion-types/src/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export type PropertyType =
4545
| 'select'
4646
| 'status'
4747
| 'multi_select'
48+
| 'auto_increment_id'
4849
| 'date'
4950
| 'person'
5051
| 'file'

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ const defaultComponents: NotionComponents = {
131131
propertyLastEditedTimeValue: dummyOverrideFn,
132132
propertyCreatedTimeValue: dummyOverrideFn,
133133
propertyDateValue: dummyOverrideFn,
134+
propertyAutoIncrementIdValue: dummyOverrideFn,
134135

135136
Pdf: dummyComponent('Pdf'),
136137
Tweet: dummyComponent('Tweet'),

packages/react-notion-x/src/icons/property-icon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react'
22

33
import { PropertyType } from 'notion-types'
44

5+
import AutoIncrementIdIcon from './type-auto-increment-id'
56
import CheckboxIcon from './type-checkbox'
67
import DateIcon from './type-date'
78
import EmailIcon from './type-email'
@@ -44,7 +45,8 @@ const iconMap = {
4445
created_time: TimestampIcon,
4546
last_edited_time: TimestampIcon,
4647
created_by: Person2Icon,
47-
last_edited_by: Person2Icon
48+
last_edited_by: Person2Icon,
49+
auto_increment_id: AutoIncrementIdIcon
4850
}
4951

5052
export const PropertyIcon: React.FC<PropertyIconProps> = ({
Lines changed: 11 additions & 0 deletions
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as React from 'react'
2+
3+
function SvgTypeAutoIncrementId(props: React.SVGProps<SVGSVGElement>) {
4+
return (
5+
<svg viewBox='0 0 16 16' {...props}>
6+
<path d='M12.252 7.9209C13.7217 7.9209 14.7266 6.93652 14.7266 5.50781C14.7266 4.0791 13.7217 3.10156 12.252 3.10156C10.8232 3.10156 9.8457 4.0791 9.8457 5.50781C9.8457 6.93652 10.8301 7.9209 12.252 7.9209ZM2.00488 13.1367C2.45605 13.1367 2.72949 12.8496 2.72949 12.3848V5.83594L7.35059 12.5967C7.6377 12.9932 7.86328 13.1367 8.20508 13.1367C8.69043 13.1367 8.96387 12.8359 8.96387 12.3232V3.8877C8.96387 3.42285 8.69043 3.12891 8.23242 3.12891C7.78809 3.12891 7.50781 3.41602 7.50781 3.8877V10.4229L2.89355 3.66895C2.60645 3.25879 2.40137 3.12891 2.03906 3.12891C1.56738 3.12891 1.27344 3.4502 1.27344 3.94238V12.3848C1.27344 12.8496 1.55371 13.1367 2.00488 13.1367ZM12.252 6.84766C11.5615 6.84766 11.0898 6.30762 11.0898 5.50781C11.0898 4.70801 11.5615 4.16797 12.252 4.16797C12.9902 4.16797 13.4756 4.70801 13.4756 5.50781C13.4756 6.30762 12.9834 6.84766 12.252 6.84766ZM10.625 9.77344H13.9541C14.3506 9.77344 14.624 9.54102 14.624 9.14453C14.624 8.74805 14.3506 8.50195 13.9541 8.50195H10.625C10.2285 8.50195 9.96191 8.74805 9.96191 9.14453C9.96191 9.54102 10.2285 9.77344 10.625 9.77344Z' />
7+
</svg>
8+
)
9+
}
10+
11+
export default SvgTypeAutoIncrementId

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
--fg-color-4: #000;
1111
--fg-color-5: rgba(55, 53, 47, 0.024);
1212
--fg-color-6: rgba(55, 53, 47, 0.8);
13+
--fg-color-7: rgba(55, 53, 47, 0.5);
1314
--fg-color-icon: var(--fg-color);
1415

1516
--bg-color: #fff;
@@ -1409,6 +1410,10 @@ svg.notion-page-icon {
14091410
padding: 7px 8px 0;
14101411
}
14111412

1413+
.notion-table-cell-auto_increment_id {
1414+
color: var(--fg-color-7);
1415+
}
1416+
14121417
.notion-property-select,
14131418
.notion-property-status,
14141419
.notion-property-multi_select {
@@ -2158,6 +2163,10 @@ svg.notion-page-icon {
21582163
width: 100%;
21592164
}
21602165

2166+
.notion-collection-row-property .notion-property-auto_increment_id {
2167+
color: var(--fg-color-7);
2168+
}
2169+
21612170
.notion-collection-row-property .notion-collection-column-title-icon {
21622171
width: 16px;
21632172
height: 16px;

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ export const PropertyImpl: React.FC<IPropertyProps> = (props) => {
276276
[block, data, schema]
277277
)
278278

279+
const renderAutoIncrementIdValue = React.useMemo(
280+
() =>
281+
function renderAutoIncrementIdValueProperty() {
282+
return <Text value={data} block={block} />
283+
},
284+
[block, data]
285+
)
286+
279287
const renderCreatedTimeValue = React.useMemo(
280288
() =>
281289
function CreatedTimeProperty() {
@@ -456,6 +464,12 @@ export const PropertyImpl: React.FC<IPropertyProps> = (props) => {
456464
// console.log('last_edited_by', schema, data)
457465
break
458466

467+
case 'auto_increment_id':
468+
content = components.propertyTextValue(
469+
props,
470+
renderAutoIncrementIdValue
471+
)
472+
break
459473
case 'text':
460474
content = components.propertyTextValue(props, renderTextValue)
461475
break

packages/react-notion-x/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface NotionComponents {
4747
propertyLastEditedTimeValue: ComponentOverrideFn
4848
propertyCreatedTimeValue: ComponentOverrideFn
4949
propertyDateValue: ComponentOverrideFn
50+
propertyAutoIncrementIdValue: ComponentOverrideFn
5051

5152
// assets
5253
Pdf: any

0 commit comments

Comments
 (0)