File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
packages/react-notion-x/src Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -789,6 +789,11 @@ export function Block(props: BlockProps) {
789
789
const formatMap = tableBlock . format ?. table_block_column_format
790
790
const backgroundColor = block . format ?. block_color
791
791
792
+ const hasRowHeader = tableBlock . format ?. table_block_column_header === true
793
+ const hasColumnHeader = tableBlock . format ?. table_block_row_header === true
794
+
795
+ const isHeaderRow = hasRowHeader && tableBlock . content ?. [ 0 ] === block . id
796
+
792
797
if ( ! tableBlock || ! order ) {
793
798
return null
794
799
}
@@ -798,16 +803,22 @@ export function Block(props: BlockProps) {
798
803
className = { cs (
799
804
'notion-simple-table-row' ,
800
805
backgroundColor && `notion-${ backgroundColor } ` ,
806
+ isHeaderRow && 'notion-simple-table-header-row' ,
801
807
blockId
802
808
) }
803
809
>
804
- { order . map ( ( column ) => {
810
+ { order . map ( ( column , columnIndex ) => {
805
811
const color = formatMap ?. [ column ] ?. color
806
812
813
+ const isHeaderColumn = hasColumnHeader && columnIndex === 0
814
+
807
815
return (
808
816
< td
809
817
key = { column }
810
- className = { color ? `notion-${ color } ` : '' }
818
+ className = { cs (
819
+ color ? `notion-${ color } ` : '' ,
820
+ isHeaderColumn && 'notion-simple-table-header-cell'
821
+ ) }
811
822
style = { {
812
823
width : formatMap ?. [ column ] ?. width || 120
813
824
} }
Original file line number Diff line number Diff line change @@ -2674,7 +2674,14 @@ svg.notion-page-icon {
2674
2674
font-size : 14px ;
2675
2675
}
2676
2676
2677
- .notion-simple-table tr : first-child td {
2677
+ /* simple table header */
2678
+ /* row header */
2679
+ .notion-simple-table-header-row td {
2680
+ background : var (--bg-color-0 );
2681
+ }
2682
+
2683
+ /* column header */
2684
+ .notion-simple-table-header-cell {
2678
2685
background : var (--bg-color-0 );
2679
2686
}
2680
2687
You can’t perform that action at this time.
0 commit comments