Skip to content

Commit 4923029

Browse files
authored
Merge pull request NotionX#349 from MichaelCasaDev/support-icons
Add support to new Notion built-in icons
2 parents 93b23a0 + 6e76a72 commit 4923029

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/react-notion-x/src/components/page-icon.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const PageIconImpl: React.FC<{
2929
hideDefaultIcon = false,
3030
defaultIcon
3131
}) => {
32-
const { mapImageUrl, recordMap } = useNotionContext()
32+
const { mapImageUrl, recordMap, darkMode } = useNotionContext()
3333
let isImage = false
3434
let content: any = null
3535

@@ -41,6 +41,20 @@ export const PageIconImpl: React.FC<{
4141
const url = mapImageUrl(icon, block)
4242
isImage = true
4343

44+
content = (
45+
<LazyImage
46+
src={url}
47+
alt={title || 'page icon'}
48+
className={cs(className, 'notion-page-icon')}
49+
/>
50+
)
51+
} else if (icon && icon.startsWith('/icons/')) {
52+
const url =
53+
'https://www.notion.so' +
54+
icon +
55+
'?mode=' +
56+
(darkMode ? 'dark' : 'light')
57+
4458
content = (
4559
<LazyImage
4660
src={url}

0 commit comments

Comments
 (0)