1
1
import { useRef , useState } from "react" ;
2
2
import { ChevronRightIcon , EditIcon } from "@chakra-ui/icons" ;
3
- import { Avatar , Box , Divider } from "@chakra-ui/react" ;
3
+ import { Avatar , Box , Divider , useColorMode } from "@chakra-ui/react" ;
4
+ import clsx from "clsx" ;
4
5
import { t } from "i18next" ;
5
6
6
7
import { hidePhoneNumber } from "@/utils/format" ;
@@ -22,6 +23,8 @@ export default function UserInfo() {
22
23
const { userInfo } = useGlobalStore ( ( state ) => state ) ;
23
24
24
25
const fileInputRef = useRef < HTMLInputElement > ( null ) ;
26
+ const { colorMode } = useColorMode ( ) ;
27
+ const darkMode = colorMode === "dark" ;
25
28
26
29
const handleClick = ( ) => {
27
30
if ( fileInputRef . current ) {
@@ -46,7 +49,7 @@ export default function UserInfo() {
46
49
} ;
47
50
48
51
return (
49
- < Box className = "flex justify-center pb-4 text-lg" >
52
+ < Box className = { clsx ( "flex justify-center pb-4 text-lg" , showItem === "" && "pt-12" ) } >
50
53
{ showItem === "" && (
51
54
< >
52
55
< Box className = "flex flex-col pr-10" >
@@ -75,11 +78,13 @@ export default function UserInfo() {
75
78
</ span >
76
79
</ div >
77
80
</ Box >
78
- < Box className = "w-[270px]" >
81
+ < Box className = "w-[270px] pt-1 " >
79
82
< div className = "flex flex-col pb-4" >
80
- < span className = "pb-3 text-xl text-grayModern-900" > { t ( "SettingPanel.UserName" ) } </ span >
83
+ < span className = { clsx ( "pb-3 text-xl" , ! darkMode && "text-grayModern-900" ) } >
84
+ { t ( "SettingPanel.UserName" ) }
85
+ </ span >
81
86
< span className = "flex justify-between text-base" >
82
- < span className = "text-grayModern-700" > { userInfo ?. username } </ span >
87
+ < span className = { ! darkMode ? "text-grayModern-700" : "" } > { userInfo ?. username } </ span >
83
88
< span
84
89
className = "flex cursor-pointer items-center text-[#0884DD]"
85
90
onClick = { ( ) => {
@@ -91,9 +96,11 @@ export default function UserInfo() {
91
96
</ span >
92
97
</ div >
93
98
< div className = "flex flex-col pb-4" >
94
- < span className = "pb-3 text-xl text-grayModern-900" > { t ( "SettingPanel.PassWord" ) } </ span >
99
+ < span className = { clsx ( "pb-3 text-xl" , ! darkMode && "text-grayModern-900" ) } >
100
+ { t ( "SettingPanel.PassWord" ) }
101
+ </ span >
95
102
< span className = "flex justify-between text-base" >
96
- < span className = "text-grayModern-700" > ****** </ span >
103
+ < span className = { ! darkMode ? "text-grayModern-700" : "" } > ∗∗∗∗∗∗ </ span >
97
104
< span
98
105
className = "flex cursor-pointer items-center text-[#0884DD]"
99
106
onClick = { ( ) => {
@@ -106,9 +113,11 @@ export default function UserInfo() {
106
113
</ div >
107
114
< Divider className = "text-grayModern-200" />
108
115
< div className = "mt-4 flex flex-col pb-4" >
109
- < span className = "pb-3 text-xl text-grayModern-900" > { t ( "SettingPanel.Tel" ) } </ span >
116
+ < span className = { clsx ( "pb-3 text-xl" , ! darkMode && "text-grayModern-900" ) } >
117
+ { t ( "SettingPanel.Tel" ) }
118
+ </ span >
110
119
< span className = "flex justify-between text-base" >
111
- < span className = "text-grayModern-700" >
120
+ < span className = { ! darkMode ? "text-grayModern-700" : "" } >
112
121
{ userInfo ?. phone ? hidePhoneNumber ( userInfo . phone ) : t ( "NoInfo" ) }
113
122
</ span >
114
123
< span
0 commit comments