Skip to content

Commit

Permalink
remove unnecessary styles from imagecard in profile page and move ima…
Browse files Browse the repository at this point in the history
…gecard to profile page
  • Loading branch information
dEdmishka committed Jan 29, 2024
1 parent 64f5409 commit c4b71b7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 49 deletions.
5 changes: 4 additions & 1 deletion src/app/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ImageCard from '@/components/pages/auth/image-card'
import FileInput from '@/components/pages/profile/file-input'
import FormProfile from '@/components/pages/profile/form-profile'
import Content from '@/components/ui/content'
Expand All @@ -8,7 +9,9 @@ export default function Profile() {
<section className="h-screen w-screen bg-gradient-blue-white">
<Content className="flex items-center justify-center dark:bg-none dark:bg-base-gray-8">
<div className="p-7 sm:p-10 flex gap-7 md:gap-[3.75rem] rounded-3xl bg-base-white dark:bg-base-black">
<FileInput />
<ImageCard className="-my-[4.375rem] flex-shrink-0 hidden sm:flex py-32 px-[3.25rem]">
<FileInput />
</ImageCard>
<div>
<div className="flex justify-between pb-2 mt-8">
<h1 className="title-lg">Profile</h1>
Expand Down
86 changes: 38 additions & 48 deletions src/components/pages/profile/file-input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'

import ImageCard from '@/components/pages/auth/image-card'
import { Icons } from '@/components/ui/icons'
import { Progress } from '@/components/ui/progress'
import { PROGRESS_TIMEOUT_DELAY } from '@/constants'
Expand Down Expand Up @@ -59,59 +58,50 @@ const FileInput: FC<FileInputProps> = ({ className }) => {
}

return (
<ImageCard
className={cn(
'-my-[4.375rem] flex-shrink-0 hidden sm:flex items-center justify-center py-32 px-[3.25rem]',
className
)}
>
<div className="relative">
{preview ? (
<div>
<Image
alt="avatar"
className="w-[144px] h-[144px] rounded-3xl"
src={preview}
/>
<Icons.cross
className="absolute z-10 top-4 right-4 text-base-white dark:text-base-black"
onClick={clearSelectFile}
/>
</div>
) : (
<div>
<Icons.photo_profile className="text-base-gray-2 dark:text-base-black" />
<div className={cn('relative', className)}>
{preview ? (
<div>
<div className="relative w-[144px] h-[144px] overflow-hidden rounded-3xl">
<Image alt="avatar" fill src={preview} />
</div>
)}
<div
className="absolute -bottom-4 right-1/2 translate-x-1/2"
onClick={handleSelectFile}
>
<Icons.mingcute_camera className="text-white dark:text-bright-indigo" />
</div>

<div
className={cn(
'absolute z-[11] top-1/2 left-1/2 w-full',
!progress && 'w-0'
)}
>
<Progress
className="w-5/6 relative mx-auto transition-[width] duration-500 ease-in-out -left-1/2"
value={progress}
<Icons.cross
className="absolute z-10 top-4 right-4 text-base-white dark:text-base-black"
onClick={clearSelectFile}
/>
</div>
) : (
<div>
<Icons.photo_profile className="text-base-gray-2 dark:text-base-black" />
</div>
)}
<div
className="absolute -bottom-4 right-1/2 translate-x-1/2"
onClick={handleSelectFile}
>
<Icons.mingcute_camera className="text-white dark:text-bright-indigo" />
</div>

<input
className="absolute block h-full w-full top-0 opacity-0 rounded-3xl"
name="image"
onChange={handleImageChange}
ref={fileInputRef}
type="file"
<div
className={cn(
'absolute z-[11] top-1/2 left-1/2 w-full',
!progress && 'w-0'
)}
>
<Progress
className="w-5/6 relative mx-auto transition-[width] duration-500 ease-in-out -left-1/2"
value={progress}
/>
<span className="sr-only">File input</span>
</div>
</ImageCard>

<input
className="absolute block h-full w-full top-0 opacity-0 rounded-3xl"
name="image"
onChange={handleImageChange}
ref={fileInputRef}
type="file"
/>
<span className="sr-only">File input</span>
</div>
)
}

Expand Down

0 comments on commit c4b71b7

Please sign in to comment.