@@ -23,7 +23,13 @@ import { SyncPointerBlock } from './components/sync-pointer-block'
2323import { Text } from './components/text'
2424import { useNotionContext } from './context'
2525import { LinkIcon } from './icons/link-icon'
26- import { cs , getListNumber , isUrl } from './utils'
26+ import {
27+ cs ,
28+ getListNestingLevel ,
29+ getListNumber ,
30+ getListStyle ,
31+ isUrl
32+ } from './utils'
2733
2834interface BlockProps {
2935 block : types . Block
@@ -433,24 +439,57 @@ export function Block(props: BlockProps) {
433439 < ol
434440 start = { start }
435441 className = { cs ( 'notion-list' , 'notion-list-numbered' , blockId ) }
442+ style = {
443+ block . type === 'numbered_list'
444+ ? {
445+ listStyleType : getListStyle (
446+ getListNestingLevel ( block . id , recordMap . block )
447+ )
448+ }
449+ : undefined
450+ }
436451 >
437452 { content }
438453 </ ol >
439454 )
440455
441456 let output : React . ReactNode | null = null
457+ const isTopLevel =
458+ block . type !== recordMap . block [ block . parent_id ] ?. value ?. type
459+ const start = getListNumber ( block . id , recordMap . block )
442460
443461 if ( block . content ) {
444- output = (
445- < >
446- { block . properties && (
447- < li >
448- < Text value = { block . properties . title } block = { block } />
449- </ li >
450- ) }
451- { wrapList ( children ) }
452- </ >
453- )
462+ const listItem = block . properties ? (
463+ < li >
464+ < Text value = { block . properties . title } block = { block } />
465+ </ li >
466+ ) : null
467+
468+ if ( block . type === 'bulleted_list' ) {
469+ output = (
470+ < >
471+ { listItem }
472+ < ul className = { cs ( 'notion-list' , 'notion-list-disc' , blockId ) } >
473+ { children }
474+ </ ul >
475+ </ >
476+ )
477+ } else {
478+ const nestingLevel = getListNestingLevel ( block . id , recordMap . block )
479+ output = (
480+ < >
481+ { listItem }
482+ < ol
483+ className = { cs ( 'notion-list' , 'notion-list-numbered' , blockId ) }
484+ style = { {
485+ listStyleType : getListStyle ( nestingLevel + 1 )
486+ } }
487+ >
488+ { children }
489+ </ ol >
490+ </ >
491+ )
492+ }
454493 } else {
455494 output = block . properties ? (
456495 < li >
@@ -459,10 +498,6 @@ export function Block(props: BlockProps) {
459498 ) : null
460499 }
461500
462- const isTopLevel =
463- block . type !== recordMap . block [ block . parent_id ] ?. value ?. type
464- const start = getListNumber ( block . id , recordMap . block )
465-
466501 return isTopLevel ? wrapList ( output , start ) : output
467502 }
468503
0 commit comments