feat: add color border to user's profile picture based on first 6 character of user's hexkey
All checks were successful
Release / build_and_release (push) Successful in 56s

This commit is contained in:
SwiftHawk 2024-04-19 14:07:18 +05:00
parent a32abaf9e7
commit 89850f881d
2 changed files with 21 additions and 8 deletions

View File

@ -1,4 +1,6 @@
import { Typography, IconButton } from '@mui/material'
import { useSelector } from 'react-redux'
import { State } from '../store/rootReducer'
type Props = {
username: string
@ -7,17 +9,28 @@ type Props = {
}
const Username = ({ username, avatarContent, handleClick }: Props) => {
const hexKey = useSelector((state: State) => state.auth.usersPubkey)
return (
<IconButton
aria-label="account of current user"
aria-controls="menu-appbar"
aria-haspopup="true"
aria-label='account of current user'
aria-controls='menu-appbar'
aria-haspopup='true'
onClick={handleClick}
color="inherit"
color='inherit'
>
<img src={avatarContent} alt="user-avatar" className="profile-image" />
<img
src={avatarContent}
alt='user-avatar'
className='profile-image'
style={{
borderWidth: '3px',
borderStyle: hexKey ? 'solid' : 'none',
borderColor: `#${hexKey?.substring(0, 6)}`
}}
/>
<Typography
variant="h6"
variant='h6'
sx={{
color: '#3e3e3e',
padding: '0 8px',

View File

@ -165,8 +165,8 @@ button:disabled {
}
.profile-image {
width: 44px;
height: 44px;
width: 40px;
height: 40px;
border-radius: 50%;
overflow: hidden;
}