Next主题可隐藏头图,并显示icon

This commit is contained in:
tangly
2022-11-18 11:44:12 +08:00
parent 12babbdbca
commit b4398e516e
5 changed files with 38 additions and 3 deletions

20
components/NotionIcon.js Normal file
View File

@@ -0,0 +1,20 @@
/**
* notion的图标icon
* 可能是emoji 可能是 svg 也可能是 图片
* @returns
*/
const NotionIcon = ({ icon }) => {
if (!icon) {
return <></>
}
if (icon.startsWith('http')) {
// return <Image src={icon} width={30} height={30}/>
// eslint-disable-next-line @next/next/no-img-element
return <img src={icon} className='w-8 float-left mr-1'/>
}
return <span className='mr-1'>{icon}</span>
}
export default NotionIcon