react-mention-input 1.0.14 → 1.0.16
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/ShowMessageCard.js +14 -10
- package/package.json +1 -1
- package/src/ShowMessageCard.tsx +15 -14
package/dist/ShowMessageCard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import './ShowMessageCard.css';
|
|
3
3
|
export var ShowMessageCard = function (_a) {
|
|
4
4
|
var data = _a.data, _b = _a.nameKey, nameKey = _b === void 0 ? 'name' : _b, _c = _a.dateKey, dateKey = _c === void 0 ? 'date' : _c, _d = _a.commentKey, commentKey = _d === void 0 ? 'comment' : _d, _e = _a.imgSrcKey, imgSrcKey = _e === void 0 ? 'imgSrc' : _e, containerClassName = _a.containerClassName, containerStyle = _a.containerStyle, cardClassName = _a.cardClassName, cardStyle = _a.cardStyle, headerClassName = _a.headerClassName, headerStyle = _a.headerStyle, imgClassName = _a.imgClassName, imgStyle = _a.imgStyle, infoClassName = _a.infoClassName, infoStyle = _a.infoStyle, nameClassName = _a.nameClassName, nameStyle = _a.nameStyle, dateClassName = _a.dateClassName, dateStyle = _a.dateStyle, bodyClassName = _a.bodyClassName, bodyStyle = _a.bodyStyle, commentClassName = _a.commentClassName, commentStyle = _a.commentStyle, renderItem = _a.renderItem // Custom render function
|
|
@@ -12,17 +12,21 @@ export var ShowMessageCard = function (_a) {
|
|
|
12
12
|
return initials;
|
|
13
13
|
};
|
|
14
14
|
return (React.createElement("div", { className: "message-card-container ".concat(containerClassName || ''), style: containerStyle }, data.map(function (item, index) {
|
|
15
|
-
if (renderItem) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
15
|
+
// if (renderItem) {
|
|
16
|
+
// // Use custom render function if provided
|
|
17
|
+
// return (
|
|
18
|
+
// <React.Fragment key={item.id || index}>
|
|
19
|
+
// {renderItem(item)}
|
|
20
|
+
// </React.Fragment>
|
|
21
|
+
// );
|
|
22
|
+
// }
|
|
23
|
+
// const [showInitials, setShowInitials] = useState(false);
|
|
24
|
+
// const handleImageError = () => {
|
|
25
|
+
// setShowInitials(true);
|
|
26
|
+
// };
|
|
23
27
|
return (React.createElement("div", { key: item.id || index, className: "message-card ".concat(cardClassName || ''), style: cardStyle },
|
|
24
28
|
React.createElement("div", { className: "message-card-header ".concat(headerClassName || ''), style: headerStyle },
|
|
25
|
-
|
|
29
|
+
!item[imgSrcKey] ? (React.createElement("div", { className: "message-card-initials ".concat(imgClassName || ''), style: imgStyle }, getInitials(item[nameKey]))) : (React.createElement("img", { src: item[imgSrcKey], alt: item[nameKey], className: "message-card-img ".concat(imgClassName || ''), style: imgStyle })),
|
|
26
30
|
React.createElement("div", { className: "message-card-info ".concat(infoClassName || ''), style: infoStyle },
|
|
27
31
|
React.createElement("h3", { className: "message-card-name ".concat(nameClassName || ''), style: nameStyle }, item[nameKey]),
|
|
28
32
|
React.createElement("p", { className: "message-card-date ".concat(dateClassName || ''), style: dateStyle }, item[dateKey]))),
|
package/package.json
CHANGED
package/src/ShowMessageCard.tsx
CHANGED
|
@@ -70,20 +70,20 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
|
|
|
70
70
|
return (
|
|
71
71
|
<div className={`message-card-container ${containerClassName || ''}`} style={containerStyle}>
|
|
72
72
|
{data.map((item, index) => {
|
|
73
|
-
if (renderItem) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
73
|
+
// if (renderItem) {
|
|
74
|
+
// // Use custom render function if provided
|
|
75
|
+
// return (
|
|
76
|
+
// <React.Fragment key={item.id || index}>
|
|
77
|
+
// {renderItem(item)}
|
|
78
|
+
// </React.Fragment>
|
|
79
|
+
// );
|
|
80
|
+
// }
|
|
81
81
|
|
|
82
|
-
const [showInitials, setShowInitials] = useState(false);
|
|
82
|
+
// const [showInitials, setShowInitials] = useState(false);
|
|
83
83
|
|
|
84
|
-
const handleImageError = () => {
|
|
85
|
-
|
|
86
|
-
};
|
|
84
|
+
// const handleImageError = () => {
|
|
85
|
+
// setShowInitials(true);
|
|
86
|
+
// };
|
|
87
87
|
|
|
88
88
|
return (
|
|
89
89
|
<div
|
|
@@ -95,7 +95,8 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
|
|
|
95
95
|
className={`message-card-header ${headerClassName || ''}`}
|
|
96
96
|
style={headerStyle}
|
|
97
97
|
>
|
|
98
|
-
{showInitials || !item[imgSrcKey] ? (
|
|
98
|
+
{/* {showInitials || !item[imgSrcKey] ? ( */}
|
|
99
|
+
{ !item[imgSrcKey] ? (
|
|
99
100
|
<div
|
|
100
101
|
className={`message-card-initials ${imgClassName || ''}`}
|
|
101
102
|
style={imgStyle}
|
|
@@ -108,7 +109,7 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
|
|
|
108
109
|
alt={item[nameKey]}
|
|
109
110
|
className={`message-card-img ${imgClassName || ''}`}
|
|
110
111
|
style={imgStyle}
|
|
111
|
-
onError={handleImageError}
|
|
112
|
+
// onError={handleImageError}
|
|
112
113
|
/>
|
|
113
114
|
)}
|
|
114
115
|
<div
|