sprint-asia-custom-component 0.1.121 → 0.1.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +143 -57
- package/package.json +1 -1
- package/src/components/dropzone/uploadphoto/index.js +14 -9
package/package.json
CHANGED
|
@@ -18,7 +18,9 @@ const DropzoneUploadPhoto = ({
|
|
|
18
18
|
const onDropRejected = (rejectedFiles) => {
|
|
19
19
|
const file = rejectedFiles[0];
|
|
20
20
|
if (file.errors[0]?.code === "file-too-large") {
|
|
21
|
-
setErrorMessage("Your file is too large
|
|
21
|
+
setErrorMessage("Your file is too large. Max file size is 5 MB");
|
|
22
|
+
} else if (file.errors[0]?.code === "file-invalid-type") {
|
|
23
|
+
setErrorMessage("Invalid file format. Only PNG, JPEG, or JPG files are allowed.");
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
26
|
|
|
@@ -26,7 +28,8 @@ const DropzoneUploadPhoto = ({
|
|
|
26
28
|
onDrop,
|
|
27
29
|
maxFiles,
|
|
28
30
|
accept: {
|
|
29
|
-
"image
|
|
31
|
+
"image/jpeg": [".jpeg", ".jpg"],
|
|
32
|
+
"image/png": [".png"],
|
|
30
33
|
},
|
|
31
34
|
noKeyboard: true,
|
|
32
35
|
maxSize: 5242881,
|
|
@@ -54,13 +57,15 @@ const DropzoneUploadPhoto = ({
|
|
|
54
57
|
<input {...getInputProps()} required={required} />
|
|
55
58
|
<div className="flex w-full h-full justify-center items-center text-center">
|
|
56
59
|
{!selectedFile ? (
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
<div className="flex flex-col justify-center items-center">
|
|
61
|
+
<PiPlus size={24} className="text-neutral300" />
|
|
62
|
+
<p className="text-sm text-neutral300">Upload Photo</p>
|
|
63
|
+
{errorMessage && (
|
|
64
|
+
<p className="text-danger500 mt-1" style={{ fontSize: 10 }}>
|
|
65
|
+
{errorMessage}
|
|
66
|
+
</p>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
64
69
|
) : typeof selectedFile === "string" ? (
|
|
65
70
|
<img src={selectedFile} alt="Selected" className="object-contain rounded-lg w-full h-full" />
|
|
66
71
|
) : (
|