diff --git a/.browserslistrc b/.browserslistrc
index 8289333..2e8bf2b 100644
--- a/.browserslistrc
+++ b/.browserslistrc
@@ -1,11 +1,12 @@
> 1%
ie >= 8
-edge >= 15
+edge >= 16
ie_mob >= 10
-ff >= 45
-chrome >= 45
-safari >= 7
-opera >= 23
-ios >= 7
-android >= 4
+ff >= 52
+chrome >= 57
+safari >= 10.1
+opera >= 44
+ios >= 10.3
+and_uc >= 12.12
+and_chr >= 97
bb >= 10
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae56773..38f34f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## Release 2.0.4 - Unreleased
+### Fixed
+* BubbleChat: Use bottom alignment for avatar
+* BubbleChat.Image: Set `lineHeight` to `0` to make image in the same baseline with avatar
+
## Release 2.0.3 - January 18, 2022
### Fixed
* Code base: use absolute imports, rearrange hooks and utils
diff --git a/src/components/BubbleChat/Image.js b/src/components/BubbleChat/Image.js
index c09381d..50bc8a2 100644
--- a/src/components/BubbleChat/Image.js
+++ b/src/components/BubbleChat/Image.js
@@ -10,7 +10,7 @@ const BubbleChatImage = React.forwardRef(({ className, ...props }, ref) => {
ref={ref}
className={classNames(
'BubbleChat-image',
- 'u-marginBottomTiny',
+ 'u-lineHeightNone',
(type === 'inbound') && 'u-textRight',
className && className
)}
diff --git a/src/components/BubbleChat/index.js b/src/components/BubbleChat/index.js
index 503538c..7f9ebe5 100644
--- a/src/components/BubbleChat/index.js
+++ b/src/components/BubbleChat/index.js
@@ -94,7 +94,7 @@ const typeThemeClassNames = {
const typeRadiusClassNames = {
inbound: 'u-roundedExtraLarge u-roundedBottomRightNone',
- outbound: 'u-roundedExtraLarge u-roundedBottomLeftNone',
+ outbound: 'u-roundedExtraLarge u-roundedBottomLeftNone',
system: 'u-roundedExtraLarge',
};
@@ -105,7 +105,65 @@ const BubbleChat = React.forwardRef(({ className, isTyping, text, type, variant,
else if (type === 'outbound') variantOri = 'light';
else if (type === 'system') variantOri = 'primaryLight';
}
+
const context = useMemo(() => ({ type }), [type]);
+
+ const renderTime = () => (
+ <>
+ {/* Empty
to occupy the bottom left corner of grid template */}
+ {type !== 'inbound' && }
+
+ {time}
+
+ {/* Empty to occupy the bottom right corner of grid template */}
+ {type === 'inbound' && }
+ >
+ );
+
+ const renderTyping = () => (
+
+ );
+
+ const renderAvatar = (type = 'outbound') => (
+
+ {typeof (avatar) === 'function'
+ ? avatar()
+ :
+ }
+
+ );
+
return (
-
- {(avatar && type !== 'inbound') && (
-
- {
- typeof (avatar) === 'function' ? avatar() :
- }
-
+
+ {(type !== 'inbound' && avatar) && renderAvatar('outbound')}
+ {/* Empty
to occupy the top left corner of grid template */}
+ {(type !== 'inbound' && !avatar) &&
}
- {isTyping && (
-
- )}
+ {isTyping && renderTyping()}
{!isTyping && (
-
- {children || (
-
- {actionBar && (
-
- {actionBar}
-
- )}
-
-
+ {children || (
+
+ {actionBar && (
+
+ {actionBar}
+
)}
- onClick={onClickText}
- >
- {text}
-
- {options && (
-
- {options.map((option, idx) => {
- let cn;
- let handleClick;
+
+
+ {text}
+
+ {options && (
+
+ {options.map((option, idx) => {
+ let cn;
+ let handleClick;
- if (option.id === currentOption) {
- cn = `u-backgroundPrimary ${textClassName || 'u-textWhite'} ${disabledOption ? 'u-cursorNotAllow' : ''}`;
- handleClick = null;
- } else if (disabledOption) {
- cn = 'u-backgroundLighter u-textGray u-cursorNotAllow';
- handleClick = null;
- } else {
- cn = 'u-backgroundWhite hover:u-backgroundLightest u-textPrimary u-cursorPointer';
- handleClick = () => onSelectOption(option.id);
- }
+ if (option.id === currentOption) {
+ cn = `u-backgroundPrimary ${textClassName || 'u-textWhite'} ${disabledOption ? 'u-cursorNotAllow' : ''}`;
+ handleClick = null;
+ } else if (disabledOption) {
+ cn = 'u-backgroundLighter u-textGray u-cursorNotAllow';
+ handleClick = null;
+ } else {
+ cn = 'u-backgroundWhite hover:u-backgroundLightest u-textPrimary u-cursorPointer';
+ handleClick = () => onSelectOption(option.id);
+ }
- return (
-
- );
- })}
+ return (
+
+ );
+ })}
+
+ )}
+
- )}
-
-
- )}
- {time && (
-
- {time}
-
- )}
-
+ )}
+
)}
- {(avatar && (type !== 'outbound' && type !== 'system')) && (
-
- {
- typeof (avatar) === 'function' ? avatar() :
- }
-
- )}
+
+ {((type !== 'outbound' && type !== 'system') && avatar) && renderAvatar('inbound')}
+ {/* Empty to occupy the top right corner of grid template */}
+ {((type !== 'outbound' && type !== 'system') && !avatar) && }
+
+ {time && renderTime()}