-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathProfileAvatarWithTeam.tsx
59 lines (52 loc) · 1.38 KB
/
ProfileAvatarWithTeam.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 { NoProfileAvatarIcon } from '@pancakeswap/uikit'
import { ASSET_CDN } from 'config/constants/endpoints'
import { Profile } from 'state/types'
import { styled } from 'styled-components'
export interface ProfileAvatarProps {
profile: Profile
}
const TeamAvatar = styled.img`
border: 1px solid ${({ theme }) => theme.card.background};
border-radius: 50%;
bottom: 0px;
position: absolute;
right: 0px;
min-width: 20px;
min-height: 20px;
width: 37.5%;
height: 37.5%;
z-index: 5;
${({ theme }) => theme.mediaQueries.sm} {
border-width: 2px;
}
`
const AvatarWrapper = styled.div<{ $bg?: string }>`
${({ $bg }) =>
$bg &&
`
background: url('${$bg}');
`}
background-repeat: no-repeat;
background-size: cover;
border-radius: 50%;
position: relative;
width: 100%;
height: 100%;
& > img {
border-radius: 50%;
}
`
// TODO: replace with no profile avatar icon
const AvatarInactive = styled(NoProfileAvatarIcon)`
width: 100%;
height: 100%;
`
const ProfileAvatarWithTeam: React.FC<React.PropsWithChildren<ProfileAvatarProps>> = ({ profile }) => {
return (
<AvatarWrapper $bg={profile.nft?.image.thumbnail}>
{!profile.isActive && <AvatarInactive />}
{profile.team && <TeamAvatar src={`${ASSET_CDN}/web/teams/${profile.team.images.alt}`} alt={profile.team.name} />}
</AvatarWrapper>
)
}
export default ProfileAvatarWithTeam