feat: 头像组件

This commit is contained in:
CrescentLeaf
2025-04-18 23:23:45 +08:00
parent 55c98027f7
commit fc2ba807c8

15
client/ui/Avatar.jsx Normal file
View File

@@ -0,0 +1,15 @@
export default function Avatar({ src, text, icon = 'person', ...props } = {}) {
return (
src ? <mdui-avatar {...props}>
<img src={src} alt={'(头像)' + text || ''} />
</mdui-avatar>
: (
text ? <mdui-avatar {...props}>
{
text.substring(0, 0)
}
</mdui-avatar>
: <mdui-avatar icon={icon} {...props} />
)
)
}