From 4441fe11326503a2ca13da234d51299eb806cb72 Mon Sep 17 00:00:00 2001
From: mackt <1033530438@qq.com>
Date: Tue, 2 Apr 2024 23:08:50 +0800
Subject: [PATCH] feat(Component): Add UserCard.
---
src/components/Header/HeaderAvatar.tsx | 3 +-
src/components/Header/UserCard.tsx | 77 ++++++++++++++++++++++++++
src/components/Header/index.tsx | 40 ++++++++++---
src/store/user.ts | 4 +-
src/types/reqeust.d.ts | 4 +-
5 files changed, 115 insertions(+), 13 deletions(-)
create mode 100644 src/components/Header/UserCard.tsx
diff --git a/src/components/Header/HeaderAvatar.tsx b/src/components/Header/HeaderAvatar.tsx
index c22ea9a..39e3b3f 100644
--- a/src/components/Header/HeaderAvatar.tsx
+++ b/src/components/Header/HeaderAvatar.tsx
@@ -5,7 +5,7 @@ import { useShallow } from 'zustand/react/shallow';
import { Avatar } from '@/components';
import useUserStore from '@/store/user';
-export default function HeaderAvatar({ className }: { className: string }) {
+export default function HeaderAvatar({ className }: { className?: string }) {
const { userInfo, setShowLogin } = useUserStore(
useShallow((state) => ({
userInfo: state.userInfo,
@@ -17,7 +17,6 @@ export default function HeaderAvatar({ className }: { className: string }) {
{/* 已登录 展示头像 */}
{!!userInfo.id &&
}
-
{/* 未登录 展示按钮 */}
{!userInfo.id && (