⭐ 

08/01/2024

img

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 const RenderBlock = (block: any) => { const blockItem = block.block; const { type, id } = blockItem; const value = blockItem[type]; switch (type) { case 'paragraph': return ( <ChakraText fontWeight='normal' mb={3} mt={2} width='100%'> <Text text={value.rich_text} /> </ChakraText> ); case 'heading_1': return ( <ChakraText fontWeight='bold' fontSize='2xl' mb={2} mt={2} width='100%'> <Text text={value.rich_text} /> </ChakraText> ); case 'numbered_list_item': return ( <li> <Text text={value.rich_text} /> </li> ); case 'code': const language = value.language; const code = value.rich_text[0].text.content; return ( <Box> <CodeBlock text={code} language={language} showLineNumbers={true} theme={atomOneDark} /> </Box> ); default: return `❌ Unsupported block (${ type === 'unsupported' ? 'unsupported by Notion API' : type })`; } };

img
;

Β© 2023 Dhas.dev All rights reserved

Builders Digest Newsletter