react-frontend-common-components 0.0.62 → 0.0.63

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-frontend-common-components",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "description": "Reusable frontend library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,30 +1,26 @@
1
1
  .profileImageContainer {
2
2
  display: flex;
3
- flex-direction: column;
4
3
  align-items: center;
4
+ gap: 2rem;
5
5
  }
6
6
 
7
- .imageWrapper img.profileImage {
8
- width: 150px;
9
- height: 150px;
10
- border-radius: 50%;
11
- object-fit: cover;
12
- display: block;
7
+ .altTextWrapper {
8
+ font-size: 0.8rem;
9
+ text-align: center;
10
+ img {
11
+ border-radius: 0;
12
+ }
13
13
  }
14
14
 
15
- .altTextWrapper .altText {
16
- width: 150px;
17
- height: 150px;
18
- display: flex;
19
- align-items: center;
20
- justify-content: center;
21
- text-align: center;
15
+ .profileImage {
16
+ width: 100px;
17
+ height: 100px;
22
18
  border-radius: 50%;
23
- background-color: #f0f0f0;
24
- color: #888;
19
+ object-fit: cover;
20
+ position: relative;
21
+ font-size: 0.8rem;
25
22
  }
26
23
 
27
- .uploadButton {
28
- margin-top: 10px;
29
- cursor: pointer;
24
+ .fileInput {
25
+ display: none;
30
26
  }
@@ -42,7 +42,7 @@ const AppUploadImage = ({
42
42
  const file = event.target.files?.[0];
43
43
  if (file) {
44
44
  const isAcceptedFormat = acceptedFormats.includes(file.type);
45
- const isLtMaxSize = file.size / 1024 / 1024 <= maxSizeMb;
45
+ const isLtMaxSize = file.size / 1024 / 1024 < maxSizeMb;
46
46
 
47
47
  if (!isAcceptedFormat) {
48
48
  alert(alertMessages.invalidType);
@@ -57,39 +57,31 @@ const AppUploadImage = ({
57
57
  const reader = new FileReader();
58
58
  reader.onloadend = () => {
59
59
  setImageUrl(reader.result as string);
60
- onFileChange?.(file);
60
+ if (onFileChange) {
61
+ onFileChange(file);
62
+ }
61
63
  };
62
64
  reader.readAsDataURL(file);
63
- } else {
64
- setImageUrl("");
65
- onFileChange?.(null);
65
+ } else if (onFileChange) {
66
+ onFileChange(null);
66
67
  }
67
68
  };
68
69
 
69
70
  return (
70
71
  <div className={`profileImageContainer ${className}`}>
71
- <div className={imageUrl ? "imageWrapper" : "altTextWrapper"}>
72
- {imageUrl ? (
73
- <img className="profileImage" src={imageUrl} alt={altText} />
74
- ) : (
75
- <span className="altText">{altText}</span>
76
- )}
72
+ <div className={imageUrl === "" ? "altTextWrapper" : ""}>
73
+ <img className={"profileImage"} src={imageUrl} alt={altText} />
77
74
  </div>
78
- <button
79
- className="uploadButton"
80
- onClick={handleButtonClick}
81
- aria-label={text}
82
- >
75
+ <button className={"uploadButton"} onClick={handleButtonClick}>
83
76
  <span>{uploadIcon || Icons.uploadIcon}</span>
84
77
  {text}
85
78
  </button>
86
79
  <input
87
80
  type="file"
88
81
  accept={acceptedFormats.join(",")}
89
- className="fileInput"
82
+ className={"fileInput"}
90
83
  ref={fileInputRef}
91
84
  onChange={handleFileChange}
92
- style={{ display: "none" }}
93
85
  />
94
86
  </div>
95
87
  );