Skip to content

Commit

Permalink
fix: avatar and banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Barresi committed Apr 16, 2024
1 parent b0bef35 commit 2c2972d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/shared/ui/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ interface IBannerProps {
}

const Banner: FC<IBannerProps> = ({ className, src }) => {
const img = import.meta.env.VITE_BACKEND_DOMEN + '/ftp/avatars/' + src || banner
return (
<img
src={src || banner}
alt='banner'
src={img}
className={cn('w-full h-full object-cover rounded-[6px]', className)}
/>
)
Expand Down
8 changes: 7 additions & 1 deletion src/widgets/edit-account/ui/avatar-change/avatar-change.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { selectUser } from '@app/store/reducers/profileInfo/selectors'
import { useAppSelector } from '@shared/lib/hooks/store-hooks'
import { Input } from '@shared/ui/input'
import { UserAvatar } from '@shared/ui/user-avatar'
import { useEffect, useState, type FC } from 'react'
Expand All @@ -6,6 +8,7 @@ import { handleFileChange } from '../../lib/handle-file-change'

const AvatarChange: FC = () => {
const { control } = useFormContext()
const user = useAppSelector(selectUser)

return (
<Controller
Expand Down Expand Up @@ -36,7 +39,10 @@ const AvatarChange: FC = () => {
<div className='z-10 flex justify-center items-center bg-black opacity-20 absolute left-0 right-0 top-0 bottom-0 rounded-full' />
</div>

<UserAvatar className='h-[100%] w-[100%]' src={previewUrl || null} />
<UserAvatar
className='h-[100%] w-[100%]'
src={previewUrl || user?.avatar || null}
/>
<Input
type='file'
className='hidden'
Expand Down

0 comments on commit 2c2972d

Please sign in to comment.