From e9a2ab37a415aea46cd43cbbebb822ed2aa25cc2 Mon Sep 17 00:00:00 2001
From: CJ <38697367+imisshtml@users.noreply.github.com>
Date: Wed, 18 Dec 2019 13:11:03 -0500
Subject: [PATCH] MM-19708 Adjusted display name width to 80% for landscape
(#3721)
Adjusted landscape maxWidth for both the base display of the name and the adjusted width with bot/reply buttons.
---
.../__snapshots__/post_header.test.js.snap | 234 ++++++++++++++++++
app/components/post_header/index.js | 2 +
app/components/post_header/post_header.js | 12 +-
.../post_header/post_header.test.js | 28 +++
4 files changed, 275 insertions(+), 1 deletion(-)
diff --git a/app/components/post_header/__snapshots__/post_header.test.js.snap b/app/components/post_header/__snapshots__/post_header.test.js.snap
index 1ae92ee78..2cdfe3e0c 100644
--- a/app/components/post_header/__snapshots__/post_header.test.js.snap
+++ b/app/components/post_header/__snapshots__/post_header.test.js.snap
@@ -31,6 +31,80 @@ exports[`PostHeader should match snapshot when just a base post 1`] = `
"maxWidth": "60%",
},
null,
+ null,
+ ]
+ }
+ type="opacity"
+ >
+
+ John Smith
+
+
+
+
+
+
+`;
+
+exports[`PostHeader should match snapshot when just a base post in landscape mode 1`] = `
+
+
+
+
@@ -275,6 +350,7 @@ exports[`PostHeader should match snapshot when post is same thread, so dont disp
"maxWidth": "60%",
},
null,
+ null,
]
}
type="opacity"
@@ -364,6 +440,162 @@ exports[`PostHeader should match snapshot when post isBot and shouldRenderReplyB
Object {
"maxWidth": "50%",
},
+ null,
+ ]
+ }
+ type="opacity"
+ >
+
+ John Smith
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+`;
+
+exports[`PostHeader should match snapshot when post isBot and shouldRenderReplyButton in landscape mode 1`] = `
+
+
+
+ 0 && renderReplies);
- const displayNameStyle = [style.displayNameContainer, showReply && (isBot || fromAutoResponder || fromWebHook) ? style.displayNameContainerBotReplyWidth : null];
+ const reduceWidth = showReply && (isBot || fromAutoResponder || fromWebHook);
+ const isLandscapeStyle = isLandscape && reduceWidth ? style.displayNameContainerLandscapeBotReplyWidth : isLandscape ? style.displayNameContainerLandscape : null; //eslint-disable-line no-nested-ternary
+ const displayNameStyle = [style.displayNameContainer, reduceWidth ? style.displayNameContainerBotReplyWidth : null, isLandscapeStyle];
if (fromAutoResponder || fromWebHook) {
let name = displayName;
@@ -367,5 +371,11 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
displayNameContainerBotReplyWidth: {
maxWidth: '50%',
},
+ displayNameContainerLandscape: {
+ maxWidth: '80%',
+ },
+ displayNameContainerLandscapeBotReplyWidth: {
+ maxWidth: '70%',
+ },
};
});
diff --git a/app/components/post_header/post_header.test.js b/app/components/post_header/post_header.test.js
index bfd9f4fde..6cff0863d 100644
--- a/app/components/post_header/post_header.test.js
+++ b/app/components/post_header/post_header.test.js
@@ -29,6 +29,7 @@ describe('PostHeader', () => {
username: 'JohnSmith',
isBot: false,
isGuest: false,
+ isLandscape: false,
userTimezone: '',
enableTimezone: false,
previousPostExists: false,
@@ -126,4 +127,31 @@ describe('PostHeader', () => {
);
expect(wrapper.getElement()).toMatchSnapshot();
});
+
+ test('should match snapshot when just a base post in landscape mode', () => {
+ const props = {
+ ...baseProps,
+ isLandscape: true,
+ };
+
+ const wrapper = shallow(
+
+ );
+ expect(wrapper.getElement()).toMatchSnapshot();
+ expect(wrapper.find('#ReplyIcon').exists()).toEqual(false);
+ });
+
+ test('should match snapshot when post isBot and shouldRenderReplyButton in landscape mode', () => {
+ const props = {
+ ...baseProps,
+ shouldRenderReplyButton: true,
+ isBot: true,
+ isLandscape: true,
+ };
+
+ const wrapper = shallow(
+
+ );
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
});
\ No newline at end of file