Skip to content

Commit

Permalink
Added a limit to images upload to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Sep 30, 2024
1 parent cd767d4 commit 352b9bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 55 deletions.
1 change: 1 addition & 0 deletions packages/nextjs/app/create/_components/ImageUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const ImageUploader: React.FC<ImageUploaderProps> = ({ image, setUploaded
<input
type="file"
accept="image/*"
multiple={false}
className="hidden"
onChange={handleFileInputChange} // Handle file input
/>
Expand Down
62 changes: 7 additions & 55 deletions packages/nextjs/app/profile/_components/ProfilePictureUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ const ProfilePictureUpload: React.FC<ProfilePictureUploadProps> = ({
<label className="w-32 h-32 flex flex-col items-center justify-center cursor-pointer text-xs m-0 border border-dashed border-gray-400 rounded-full">
<span className="text-5xl h-auto rounded-full">+</span>
<span className="font-bold">Upload image</span>
<input type="file" accept="image/*" className="hidden" onChange={handleFileInputChange} />
<input
type="file"
accept="image/*"
multiple={false}
className="hidden"
onChange={handleFileInputChange}
/>
</label>
)}
</div>
Expand All @@ -142,60 +148,6 @@ const ProfilePictureUpload: React.FC<ProfilePictureUploadProps> = ({
Uploading...
</div>
)}
{/* {hovered && !isEditing && (
<button
className="absolute top-5 right-5 bg-red-500 text-white w-6 h-6 flex items-center justify-center rounded-full"
onClick={() => setIsEditing(true)}
>
</button>
)} */}
{/* {previewImage ? (
<div className="relative w-full h-full flex items-center justify-center">
<Image
src={previewImage ? profilePicture : defaultProfilePicture}
alt="Profile Pixar Preview"
className="rounded-full object-cover"
width={128}
height={128}
/>
{hovered && isEditing && (
<button
className="absolute top-5 right-5 bg-red-500 text-white w-6 h-6 flex items-center justify-center rounded-full"
onClick={handleRemoveImage}
>
</button>
)}
</div>
) : isEditing ? (
<div className="absolute inset-0 flex flex-col items-center justify-center text-center p-2">
<label className="w-full h-full flex flex-col items-center justify-center cursor-pointer text-xs m-0">
<span className="text-5xl h-auto rounded-full">+</span>
<span className="font-bold">Upload image</span>
<input
type="file"
accept="image/*"
className="hidden"
onChange={handleFileInputChange} // Handle file input
/>
</label>
</div>
) : (
<Image
src={profilePicture ? profilePicture : defaultProfilePicture}
alt="Profile Disney Preview"
className="rounded-full object-cover"
width={128}
height={128}
/>
)}
{loading && (
<div className="absolute inset-0 flex items-center justify-center bg-gray-700 bg-opacity-75 text-white">
Uploading...
</div>
)} */}
</div>
);
};
Expand Down

0 comments on commit 352b9bb

Please sign in to comment.