1
1
import { RelativeTimeWithTooltip } from '../RelativeTimeWithTooltip' ;
2
2
import { UserLink } from '../Links' ;
3
3
import { useUserInfo } from '../../hooks/useEntityAuthor' ;
4
- import { Avatar , Box , Grid , makeStyles , Typography } from '@material-ui/core' ;
4
+ import { Avatar , Box , makeStyles , Typography } from '@material-ui/core' ;
5
5
import { ExpertIcon } from '../Icons/ExpertIcon.tsx' ;
6
6
7
7
const useStyles = makeStyles (
8
8
theme => ( {
9
9
authorBox : {
10
10
padding : theme . spacing ( 0 , 1.5 , 0 , 0 ) ,
11
11
textAlign : 'right' ,
12
- width : 220 ,
13
- background : theme . palette . background . paper ,
14
- borderRadius : theme . shape . borderRadius ,
15
12
display : 'flex' ,
16
13
flexDirection : 'column' ,
17
- justifyContent : 'flex-start' ,
18
14
gap : theme . spacing ( 0.5 ) ,
15
+ marginLeft : theme . spacing ( 2 ) ,
16
+ maxWidth : '200px' ,
19
17
} ,
20
- authorRow : {
18
+ timeRow : {
21
19
display : 'flex' ,
22
20
alignItems : 'center' ,
23
- width : '100%' ,
24
- marginTop : theme . spacing ( 0.5 ) ,
25
- marginBottom : theme . spacing ( 0.5 ) ,
26
21
} ,
27
22
avatar : {
28
- width : theme . spacing ( 3 ) ,
29
- height : theme . spacing ( 3 ) ,
30
- marginRight : theme . spacing ( 1 ) ,
23
+ width : '20px' ,
24
+ height : '20px' ,
31
25
} ,
32
- authorLink : {
26
+ authorInfo : {
33
27
textOverflow : 'ellipsis' ,
34
28
overflow : 'hidden' ,
35
29
whiteSpace : 'nowrap' ,
36
- fontWeight : 600 ,
37
30
color : theme . palette . text . primary ,
38
31
display : 'flex' ,
39
32
alignItems : 'center' ,
40
33
gap : theme . spacing ( 0.5 ) ,
41
34
} ,
35
+ authorLink : {
36
+ textOverflow : 'ellipsis' ,
37
+ overflow : 'hidden' ,
38
+ whiteSpace : 'nowrap' ,
39
+ color : theme . palette . text . primary ,
40
+ } ,
42
41
expertIcon : {
43
42
marginLeft : theme . spacing ( 0.5 ) ,
44
43
verticalAlign : 'middle' ,
@@ -65,39 +64,25 @@ export const AuthorBox = (props: {
65
64
66
65
return (
67
66
< Box className = { `qetaAuthorBox ${ styles . authorBox } ` } >
68
- < Grid container alignItems = "center" justifyContent = "flex-end" spacing = { 0 } >
69
- < Grid item xs = { 12 } style = { { paddingBottom : 0 } } >
70
- < Typography className = "qetaAuthorBoxCreated" variant = "caption" >
71
- { label } < RelativeTimeWithTooltip value = { time } />
72
- </ Typography >
73
- </ Grid >
74
-
75
- < Grid item style = { { paddingTop : 0 } } >
76
- < Avatar
77
- src = { user ?. spec ?. profile ?. picture }
78
- className = "qetaAuthorBoxAvatar avatar"
79
- alt = { name }
80
- variant = "rounded"
81
- style = { { width : '1.2em' , height : '1.2em' } }
82
- >
83
- { initials }
84
- </ Avatar >
85
- </ Grid >
86
- < Grid
87
- item
88
- style = { {
89
- paddingTop : 0 ,
90
- textOverflow : 'ellipsis' ,
91
- overflow : 'hidden' ,
92
- whiteSpace : 'nowrap' ,
93
- } }
67
+ < Box className = { styles . timeRow } >
68
+ < Typography className = "qetaAuthorBoxCreated" variant = "caption" >
69
+ { label } < RelativeTimeWithTooltip value = { time } />
70
+ </ Typography >
71
+ </ Box >
72
+ < Box className = { styles . authorInfo } >
73
+ < Avatar
74
+ src = { user ?. spec ?. profile ?. picture }
75
+ className = { `qetaAuthorBoxAvatar ${ styles . avatar } ` }
76
+ alt = { name }
77
+ variant = "rounded"
94
78
>
95
- < Box style = { { paddingLeft : '0.3em' } } >
96
- < UserLink entityRef = { userEntityRef } anonymous = { anonymous } />
97
- { expert && < ExpertIcon /> }
98
- </ Box >
99
- </ Grid >
100
- </ Grid >
79
+ { initials }
80
+ </ Avatar >
81
+ < Box className = { styles . authorLink } >
82
+ < UserLink entityRef = { userEntityRef } anonymous = { anonymous } />
83
+ { expert && < ExpertIcon className = { styles . expertIcon } /> }
84
+ </ Box >
85
+ </ Box >
101
86
</ Box >
102
87
) ;
103
88
} ;
0 commit comments