Skip to content

Commit 84205c2

Browse files
Match message thread color in composite to composite background (#2126)
* Add a background color to all composites * Change files * comment grammar fix * Removing background color override in control bar * updating comment * Change files * updating comment * Update composite automation snapshots * Update composite automation snapshots * Update composite automation snapshots * Update composite automation snapshots * Update composite automation snapshots * Un-memoizing classname * Update composite automation snapshots * Update composite automation snapshots * Adding custom background to control bars in call and call withchat * Update composite automation snapshots * Adding background color to message thread in composite to match composite background * Change files * Update changelog Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent e044dfb commit 84205c2

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Message thread background color in composites matches composite background color",
4+
"packageName": "@internal/react-composites",
5+
"email": "anjulgarg@live.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-composites/src/composites/ChatComposite/ChatScreen.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
SendBox,
1414
SendBoxStylesProps,
1515
TypingIndicator,
16-
TypingIndicatorStylesProps
16+
TypingIndicatorStylesProps,
17+
useTheme
1718
} from '@internal/react-components';
1819
import React, { useCallback, useEffect } from 'react';
1920
import { AvatarPersona, AvatarPersonaDataCallback } from '../common/AvatarPersona';
@@ -122,6 +123,8 @@ export const ChatScreen = (props: ChatScreenProps): JSX.Element => {
122123
const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');
123124

124125
const adapter = useAdapter();
126+
const theme = useTheme();
127+
125128
useEffect(() => {
126129
// Initial data should be always fetched by the composite(or external caller) instead of the adapter
127130
adapter.fetchInitialData();
@@ -147,7 +150,11 @@ export const ChatScreen = (props: ChatScreenProps): JSX.Element => {
147150
[onFetchAvatarPersonaData]
148151
);
149152

150-
const messageThreadStyles = Object.assign({}, messageThreadChatCompositeStyles, styles?.messageThread);
153+
const messageThreadStyles = Object.assign(
154+
{},
155+
messageThreadChatCompositeStyles(theme.semanticColors.bodyBackground),
156+
styles?.messageThread
157+
);
151158
const typingIndicatorStyles = Object.assign({}, styles?.typingIndicator);
152159
const sendBoxStyles = Object.assign({}, styles?.sendBox);
153160
const userId = toFlatCommunicationIdentifier(adapter.getState().userId);

packages/react-composites/src/composites/ChatComposite/styles/Chat.styles.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { IStyle, mergeStyles } from '@fluentui/react';
4+
import { IStyle, memoizeFunction, mergeStyles } from '@fluentui/react';
55
import { MessageThreadStyles } from '@internal/react-components';
66

77
const MESSAGE_THREAD_WIDTH = '41.25rem';
@@ -93,7 +93,12 @@ export const topicNameLabelStyle = mergeStyles({
9393
/**
9494
* @private
9595
*/
96-
export const messageThreadChatCompositeStyles: MessageThreadStyles = { root: { maxWidth: MESSAGE_THREAD_WIDTH } };
96+
export const messageThreadChatCompositeStyles = memoizeFunction(
97+
(background: string): MessageThreadStyles => ({
98+
root: { maxWidth: MESSAGE_THREAD_WIDTH },
99+
chatContainer: { background: background }
100+
})
101+
);
97102

98103
/**
99104
* @private

0 commit comments

Comments
 (0)