-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyInfo.tsx
59 lines (54 loc) · 1.29 KB
/
MyInfo.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React, { useCallback } from 'react'
import styled from '@emotion/styled'
import Settings from '@mui/icons-material/Settings'
import { useUiActions } from '../../state/ui/hooks'
import { useUserIdAndAccount } from '../../state/user/hooks'
export const MyInfo = () => {
const { userAccount, userIconUrl } = useUserIdAndAccount()
const { toggleSettings } = useUiActions()
const clickSettings = useCallback(() => {
toggleSettings()
}, [toggleSettings])
const icon = userIconUrl ? userIconUrl : null
const m = userAccount ? userAccount : ''
return (
<Wrap>
<div className="profile-wrap">
{icon && (
<img
className="icon-img"
src={icon}
width="20"
height="20"
crossOrigin="anonymous"
/>
)}
<div className="profile">{m}</div>
<Settings className="settings-icon" onClick={clickSettings} />
</div>
</Wrap>
)
}
const Wrap = styled.div`
padding: 8px 0;
.profile-wrap {
display: flex;
}
.icon-img {
margin: 0 10px 0 0;
width: 25px;
height: 25px;
border-radius: 2px;
}
.profile {
margin: 0 8px 0 0;
font-size: 18px;
line-height: 25px;
}
.more-ver-icon {
cursor: pointer;
}
.settings-icon {
cursor: pointer;
}
`