diff --git a/change/@internal-react-composites-cb2a0169-f171-4264-a126-c5bbd66d43b4.json b/change/@internal-react-composites-cb2a0169-f171-4264-a126-c5bbd66d43b4.json new file mode 100644 index 00000000000..1f522da7025 --- /dev/null +++ b/change/@internal-react-composites-cb2a0169-f171-4264-a126-c5bbd66d43b4.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Message thread background color in composites matches composite background color", + "packageName": "@internal/react-composites", + "email": "anjulgarg@live.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-composites/src/composites/ChatComposite/ChatScreen.tsx b/packages/react-composites/src/composites/ChatComposite/ChatScreen.tsx index 1e8bec4e643..e8e18c335af 100644 --- a/packages/react-composites/src/composites/ChatComposite/ChatScreen.tsx +++ b/packages/react-composites/src/composites/ChatComposite/ChatScreen.tsx @@ -13,7 +13,8 @@ import { SendBox, SendBoxStylesProps, TypingIndicator, - TypingIndicatorStylesProps + TypingIndicatorStylesProps, + useTheme } from '@internal/react-components'; import React, { useCallback, useEffect } from 'react'; import { AvatarPersona, AvatarPersonaDataCallback } from '../common/AvatarPersona'; @@ -122,6 +123,8 @@ export const ChatScreen = (props: ChatScreenProps): JSX.Element => { const [downloadErrorMessage, setDownloadErrorMessage] = React.useState(''); const adapter = useAdapter(); + const theme = useTheme(); + useEffect(() => { // Initial data should be always fetched by the composite(or external caller) instead of the adapter adapter.fetchInitialData(); @@ -147,7 +150,11 @@ export const ChatScreen = (props: ChatScreenProps): JSX.Element => { [onFetchAvatarPersonaData] ); - const messageThreadStyles = Object.assign({}, messageThreadChatCompositeStyles, styles?.messageThread); + const messageThreadStyles = Object.assign( + {}, + messageThreadChatCompositeStyles(theme.semanticColors.bodyBackground), + styles?.messageThread + ); const typingIndicatorStyles = Object.assign({}, styles?.typingIndicator); const sendBoxStyles = Object.assign({}, styles?.sendBox); const userId = toFlatCommunicationIdentifier(adapter.getState().userId); diff --git a/packages/react-composites/src/composites/ChatComposite/styles/Chat.styles.ts b/packages/react-composites/src/composites/ChatComposite/styles/Chat.styles.ts index 41d7156800b..dbddef52af0 100644 --- a/packages/react-composites/src/composites/ChatComposite/styles/Chat.styles.ts +++ b/packages/react-composites/src/composites/ChatComposite/styles/Chat.styles.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { IStyle, mergeStyles } from '@fluentui/react'; +import { IStyle, memoizeFunction, mergeStyles } from '@fluentui/react'; import { MessageThreadStyles } from '@internal/react-components'; const MESSAGE_THREAD_WIDTH = '41.25rem'; @@ -93,7 +93,12 @@ export const topicNameLabelStyle = mergeStyles({ /** * @private */ -export const messageThreadChatCompositeStyles: MessageThreadStyles = { root: { maxWidth: MESSAGE_THREAD_WIDTH } }; +export const messageThreadChatCompositeStyles = memoizeFunction( + (background: string): MessageThreadStyles => ({ + root: { maxWidth: MESSAGE_THREAD_WIDTH }, + chatContainer: { background: background } + }) +); /** * @private