Update NotionIcon.js

This commit is contained in:
段枫
2024-09-12 13:33:03 +08:00
committed by GitHub
parent cb759f9b48
commit b9632d2077

View File

@@ -5,18 +5,16 @@ import LazyImage from './LazyImage'
* 可能是emoji 可能是 svg 也可能是 图片
* @returns
*/
const NotionIcon = ({ icon, className = 'w-8 h-8 my-auto inline mr-1' }) => {
const NotionIcon = ({ icon }) => {
if (!icon) {
return <></>
}
if (icon.startsWith('http') || icon.startsWith('data:')) {
// 这里优先使用传入的 className
return <LazyImage src={icon} className={className} />
return <LazyImage src={icon} className='w-8 h-8 my-auto inline mr-1'/>
}
// 对于 emoji 或 svg设置默认 className也可以传递不同的样式
return <span className={`inline-block ${className}`}>{icon}</span>
return <span className='mr-1'>{icon}</span>
}
export default NotionIcon
export default NotionIcon