Skip to content

Commit a7447b0

Browse files
committed
fix: style status property values
1 parent 2ab9a7a commit a7447b0

File tree

3 files changed

+125
-12
lines changed

3 files changed

+125
-12
lines changed

packages/notion-types/src/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export type PropertyType =
4343
| 'text'
4444
| 'number'
4545
| 'select'
46+
| 'status'
4647
| 'multi_select'
4748
| 'date'
4849
| 'person'

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

Lines changed: 85 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,38 @@
5151
--notion-brown_background_co: rgba(233, 229, 227, 0.3);
5252
--notion-gray_background_co: rgba(235, 236, 237, 0.3);
5353

54-
--notion-item-blue: rgba(0, 120, 223, 0.2);
55-
--notion-item-orange: rgba(245, 93, 0, 0.2);
56-
--notion-item-green: rgba(0, 135, 107, 0.2);
57-
--notion-item-pink: rgba(221, 0, 129, 0.2);
58-
--notion-item-brown: rgba(140, 46, 0, 0.2);
59-
--notion-item-red: rgba(255, 0, 26, 0.2);
60-
--notion-item-yellow: rgba(233, 168, 0, 0.2);
61-
--notion-item-default: rgba(206, 205, 202, 0.5);
62-
--notion-item-purple: rgba(103, 36, 222, 0.2);
63-
--notion-item-gray: rgba(155, 154, 151, 0.4);
54+
--notion-item-blue: rgb(211, 229, 239);
55+
--notion-item-orange: rgb(250, 222, 201);
56+
--notion-item-green: rgb(219, 237, 219);
57+
--notion-item-pink: rgb(245, 224, 233);
58+
--notion-item-brown: rgb(238, 224, 218);
59+
--notion-item-red: rgb(255, 226, 221);
60+
--notion-item-yellow: rgb(253, 236, 200);
61+
--notion-item-default: rgba(227, 226, 224, 0.5);
62+
--notion-item-purple: rgb(232, 222, 238);
63+
--notion-item-gray: rgb(227, 226, 224);
64+
65+
--notion-item-text-blue: rgb(24, 51, 71);
66+
--notion-item-text-orange: rgb(73, 41, 14);
67+
--notion-item-text-green: rgb(28, 56, 41);
68+
--notion-item-text-pink: rgb(76, 35, 55);
69+
--notion-item-text-brown: rgb(68, 42, 30);
70+
--notion-item-text-red: rgb(93, 23, 21);
71+
--notion-item-text-yellow: rgb(64, 44, 27);
72+
--notion-item-text-default: rgb(50, 48, 44);
73+
--notion-item-text-purple: rgb(65, 36, 84);
74+
--notion-item-text-gray: rgb(50, 48, 44);
75+
76+
--notion-item-bullet-blue: rgb(91, 151, 189);
77+
--notion-item-bullet-orange: rgb(215, 129, 58);
78+
--notion-item-bullet-green: rgb(108, 155, 125);
79+
--notion-item-bullet-pink: rgb(205, 116, 159);
80+
--notion-item-bullet-brown: rgb(187, 132, 108);
81+
--notion-item-bullet-red: rgb(225, 111, 100);
82+
--notion-item-bullet-yellow: rgb(203, 148, 51);
83+
--notion-item-bullet-default: rgb(91, 151, 189);
84+
--notion-item-bullet-purple: rgb(167, 130, 195);
85+
--notion-item-bullet-gray: rgb(145, 145, 142);
6486

6587
--notion-max-width: 720px;
6688
--notion-header-height: 45px;
@@ -371,33 +393,78 @@
371393

372394
.notion-item-blue {
373395
background-color: var(--notion-item-blue);
396+
color: var(--notion-item-text-blue);
374397
}
375398
.notion-item-orange {
376399
background-color: var(--notion-item-orange);
400+
color: var(--notion-item-text-orange);
377401
}
378402
.notion-item-green {
379403
background-color: var(--notion-item-green);
404+
color: var(--notion-item-text-green);
380405
}
381406
.notion-item-pink {
382407
background-color: var(--notion-item-pink);
408+
color: var(--notion-item-text-pink);
383409
}
384410
.notion-item-brown {
385411
background-color: var(--notion-item-brown);
412+
color: var(--notion-item-text-brown);
386413
}
387414
.notion-item-red {
388415
background-color: var(--notion-item-red);
416+
color: var(--notion-item-text-red);
389417
}
390418
.notion-item-yellow {
391419
background-color: var(--notion-item-yellow);
420+
color: var(--notion-item-text-yellow);
392421
}
393-
.notion-item-default {
422+
.notion-item-default,
423+
.notion-item-default-inferred {
394424
background-color: var(--notion-item-default);
425+
color: var(--notion-item-text-default);
395426
}
396427
.notion-item-purple {
397428
background-color: var(--notion-item-purple);
429+
color: var(--notion-item-text-purple);
398430
}
399431
.notion-item-gray {
400432
background-color: var(--notion-item-gray);
433+
color: var(--notion-item-text-gray);
434+
}
435+
436+
.notion-item-bullet-blue {
437+
background-color: var(--notion-item-bullet-blue);
438+
}
439+
.notion-item-bullet-orange {
440+
background-color: var(--notion-item-bullet-orange);
441+
}
442+
.notion-item-bullet-green {
443+
background-color: var(--notion-item-bullet-green);
444+
}
445+
.notion-item-bullet-pink {
446+
background-color: var(--notion-item-bullet-pink);
447+
}
448+
.notion-item-bullet-brown {
449+
background-color: var(--notion-item-bullet-brown);
450+
}
451+
.notion-item-bullet-red {
452+
background-color: var(--notion-item-bullet-red);
453+
}
454+
.notion-item-bullet-yellow {
455+
background-color: var(--notion-item-bullet-yellow);
456+
}
457+
.notion-item-bullet-default {
458+
background-color: var(--notion-item-bullet-default);
459+
}
460+
.notion-item-bullet-default-inferred {
461+
background-color: var(--notion-item-bullet-gray);
462+
}
463+
.notion-item-bullet-purple {
464+
background-color: var(--notion-item-bullet-purple);
465+
}
466+
.notion-item-bullet-gray {
467+
background-color: var(--notion-item-bullet-gray);
401468
}
402469

403470
.notion b {
@@ -1343,25 +1410,31 @@ svg.notion-page-icon {
13431410
}
13441411

13451412
.notion-property-select,
1413+
.notion-property-status,
13461414
.notion-property-multi_select {
13471415
display: flex;
13481416
flex-wrap: wrap;
13491417
gap: 6px;
13501418
}
13511419

13521420
.notion-property-select-item,
1421+
.notion-property-status-item,
13531422
.notion-property-multi_select-item {
13541423
display: flex;
13551424
align-items: center;
13561425
padding: 0 6px;
13571426
border-radius: 3px;
1358-
height: 18px;
1427+
height: 20px;
13591428
white-space: nowrap;
13601429
overflow: hidden;
13611430
text-overflow: ellipsis;
13621431
line-height: 120%;
13631432
}
13641433

1434+
.notion-property-status-item {
1435+
border-radius: 20px;
1436+
}
1437+
13651438
.notion-property-file {
13661439
display: flex;
13671440
flex-wrap: wrap;

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,45 @@ export const PropertyImpl: React.FC<IPropertyProps> = (props) => {
327327
content = components.propertyTitleValue(props, renderTitleValue)
328328
break
329329

330+
case 'status': {
331+
const value = data[0][0] || ''
332+
333+
const option = schema.options?.find((option) => value === option.value)
334+
335+
const color = option?.color || 'default-inferred'
336+
337+
content = components.propertySelectValue(
338+
{
339+
...props,
340+
value,
341+
option,
342+
color
343+
},
344+
() => (
345+
<div
346+
className={cs(
347+
`notion-property-${schema.type}-item`,
348+
color && `notion-item-${color}`
349+
)}
350+
>
351+
<span
352+
className={cs(`notion-item-bullet-${color}`)}
353+
style={{
354+
marginRight: '5px',
355+
borderRadius: '100%',
356+
height: '8px',
357+
width: '8px',
358+
display: 'inline-flex',
359+
flexShrink: 0
360+
}}
361+
/>
362+
{value}
363+
</div>
364+
)
365+
)
366+
break
367+
}
368+
330369
case 'select':
331370
// intentional fallthrough
332371
case 'multi_select': {

0 commit comments

Comments
 (0)