import s from './index.module.css' import cn from '@/utils/classnames' import type { DataSourceNotionPage } from '@/models/common' type IconTypes = 'workspace' | 'page' type NotionIconProps = { type?: IconTypes name?: string | null className?: string src?: string | null | DataSourceNotionPage['page_icon'] } const NotionIcon = ({ type = 'workspace', src, name, className, }: NotionIconProps) => { if (type === 'workspace') { if (typeof src === 'string') { if (src.startsWith('https://') || src.startsWith('http://')) { return ( workspace icon ) } return (
{src}
) } return (
{name?.[0].toLocaleUpperCase()}
) } if (typeof src === 'object' && src !== null) { if (src?.type === 'url') { return ( page icon ) } return (
{src?.emoji}
) } return (
) } export default NotionIcon