@@ -7,6 +7,7 @@ import Stack from '@mui/material/Stack'
7
7
import ListItemText from '@mui/material/ListItemText'
8
8
import ListItemIcon from '@mui/material/ListItemIcon'
9
9
import Avatar from '@mui/material/Avatar'
10
+ import useMediaQuery from '@mui/material/useMediaQuery'
10
11
import PersonRoundedIcon from '@mui/icons-material/PersonRounded'
11
12
import EditRoundedIcon from '@mui/icons-material/EditRounded'
12
13
import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded'
@@ -26,6 +27,7 @@ const AccountButton: FC = () => {
26
27
const theme = useTheme ( )
27
28
28
29
const { Menu, open, close } = useAnchorMenu ( )
30
+ const matches = useMediaQuery ( theme . breakpoints . up ( 'sm' ) )
29
31
30
32
const onLogout = ( ) => {
31
33
close ( )
@@ -35,22 +37,44 @@ const AccountButton: FC = () => {
35
37
}
36
38
37
39
if ( ! account && ! didname ) {
40
+ if ( matches ) {
41
+ return (
42
+ < Button variant = "gradient" onClick = { ( ) => selectDialog . open ( ) } >
43
+ Login
44
+ </ Button >
45
+ )
46
+ }
38
47
return (
39
- < Button variant = "gradient" onClick = { ( ) => selectDialog . open ( ) } >
40
- Login
41
- </ Button >
48
+ < Avatar
49
+ alt = { profile . name }
50
+ sx = { {
51
+ width : 24 ,
52
+ height : 24 ,
53
+ } }
54
+ />
42
55
)
43
56
}
44
57
if ( ! didname ) {
58
+ if ( matches ) {
59
+ return (
60
+ < Button
61
+ variant = "outlined"
62
+ onClick = { ( ) => {
63
+ onLogout ( )
64
+ } }
65
+ >
66
+ Logging in
67
+ </ Button >
68
+ )
69
+ }
45
70
return (
46
- < Button
47
- variant = "outlined"
48
- onClick = { ( ) => {
49
- onLogout ( )
71
+ < Avatar
72
+ alt = { profile . name }
73
+ sx = { {
74
+ width : 24 ,
75
+ height : 24 ,
50
76
} }
51
- >
52
- Logging in
53
- </ Button >
77
+ />
54
78
)
55
79
}
56
80
return (
@@ -59,7 +83,7 @@ const AccountButton: FC = () => {
59
83
component = "button"
60
84
elevation = { 3 }
61
85
sx = { {
62
- p : '10px 20px' ,
86
+ p : matches ? '10px 20px' : '5px ',
63
87
borderRadius : '12px' ,
64
88
border : 'solid 1px transparent' ,
65
89
'&:hover' : {
@@ -69,19 +93,30 @@ const AccountButton: FC = () => {
69
93
} }
70
94
onClick = { open }
71
95
>
72
- < Stack spacing = { 2 } direction = "row" justifyContent = "center" >
96
+ { matches ? (
97
+ < Stack spacing = { 2 } direction = "row" justifyContent = "center" >
98
+ < Avatar
99
+ alt = { profile . name }
100
+ src = { format ( profile . avatar ) }
101
+ sx = { {
102
+ width : 36 ,
103
+ height : 36 ,
104
+ } }
105
+ />
106
+ < H4 fontWeight = "medium" lineHeight = "36px" >
107
+ { didname }
108
+ </ H4 >
109
+ </ Stack >
110
+ ) : (
73
111
< Avatar
74
112
alt = { profile . name }
75
113
src = { format ( profile . avatar ) }
76
114
sx = { {
77
- width : 36 ,
78
- height : 36 ,
115
+ width : 24 ,
116
+ height : 24 ,
79
117
} }
80
118
/>
81
- < H4 fontWeight = "medium" lineHeight = "36px" >
82
- { didname }
83
- </ H4 >
84
- </ Stack >
119
+ ) }
85
120
</ Paper >
86
121
< Menu
87
122
sx = { {
0 commit comments