Răsfoiți Sursa

支持头像颜色

visuddhinanda 2 ani în urmă
părinte
comite
c2d8dfa7fd
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      dashboard/src/components/auth/User.tsx

+ 6 - 1
dashboard/src/components/auth/User.tsx

@@ -1,4 +1,5 @@
 import { Avatar, Space } from "antd";
+import { getAvatarColor } from "./Studio";
 
 export interface IUser {
   id: string;
@@ -24,7 +25,11 @@ const UserWidget = ({
   return (
     <Space>
       {showAvatar ? (
-        <Avatar size="small" src={avatar}>
+        <Avatar
+          size="small"
+          src={avatar}
+          style={{ backgroundColor: getAvatarColor(nickName) }}
+        >
           {nickName?.slice(0, 2)}
         </Avatar>
       ) : undefined}