Skip to content

Commit 41c83f8

Browse files
Update page-icon.tsx
Added support for the new Notion built-in icons feature
1 parent 7cfd015 commit 41c83f8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 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,17 @@ 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+
'http://www.notion.so' + icon + '?mode=' + (darkMode ? 'dark' : 'light')
54+
4455
content = (
4556
<LazyImage
4657
src={url}

0 commit comments

Comments
 (0)