heo封面居中

动画调整
单独控制标题处NotionIcon使其居中
This commit is contained in:
JonasTech0
2024-09-12 09:57:27 +08:00
parent 74fef377cb
commit 2cd7f13f02
3 changed files with 42 additions and 35 deletions

View File

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