1- import { Group , Menu , Text , UnstyledButton } from '@mantine/core' ;
1+ import { Group , Menu , Stack , Text , UnstyledButton } from '@mantine/core' ;
22import { useBoolean } from 'ahooks' ;
33import { forwardRef } from 'react' ;
44import { useNavigate } from 'react-router-dom' ;
@@ -10,18 +10,19 @@ import { UpdateProfileModal } from './update-profile';
1010interface UserButtonProps extends React . ComponentPropsWithoutRef < 'button' > {
1111 username : string ;
1212 email : string ;
13+ height : number ;
1314}
1415
1516const UserButton = forwardRef < HTMLButtonElement , UserButtonProps > (
16- ( { username, email, ...rest } : UserButtonProps , ref ) => (
17+ ( { username, email, height , ...rest } : UserButtonProps , ref ) => (
1718 < UnstyledButton
1819 ref = { ref }
1920 px = "md"
2021 py = { 0 }
2122 sx = { ( theme ) => ( {
2223 display : 'block' ,
2324 width : '100%' ,
24- height : '60px' ,
25+ height,
2526 color : theme . black ,
2627
2728 '&:hover' : {
@@ -31,23 +32,24 @@ const UserButton = forwardRef<HTMLButtonElement, UserButtonProps>(
3132 { ...rest }
3233 >
3334 < Group >
34- < div style = { { flex : 1 } } >
35+ < Stack spacing = { 0 } style = { { flex : 1 } } >
3536 < Text size = "sm" weight = { 500 } >
3637 { username }
3738 </ Text >
38-
39- < Text color = "dimmed" size = "xs" >
40- { email }
41- </ Text >
42- </ div >
39+ { email && (
40+ < Text mt = { - 4 } color = "dimmed" size = { 11 } >
41+ { email }
42+ </ Text >
43+ ) }
44+ </ Stack >
4345
4446 < ChevronRight size = { 16 } />
4547 </ Group >
4648 </ UnstyledButton >
4749 ) ,
4850) ;
4951
50- export function AccountDropdown ( ) {
52+ export function AccountDropdown ( { height } : { height : number } ) {
5153 const { account } = useAccountContext ( ) ;
5254 const navigate = useNavigate ( ) ;
5355 const logout = ( ) => {
@@ -62,7 +64,7 @@ export function AccountDropdown() {
6264 < Group position = "center" >
6365 < Menu withinPortal >
6466 < Menu . Target >
65- < UserButton username = { account . name } email = { account . email } />
67+ < UserButton username = { account . name } email = { account . email } height = { height } />
6668 </ Menu . Target >
6769 < Menu . Dropdown >
6870 < Menu . Label > Account Settings</ Menu . Label >
0 commit comments