From e9626ce9a3c5d105c345c89e0b0f1e1ec87851f7 Mon Sep 17 00:00:00 2001 From: Srinaath Ravichandran Date: Wed, 29 Jan 2020 17:51:45 -0800 Subject: [PATCH] Updated download attachment style updated Signed-off-by: Srinaath Ravichandran --- .../ui/editor/emulator/parts/chat/chat.spec.tsx | 7 +++++++ .../src/ui/editor/emulator/parts/chat/chat.tsx | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx index 5f8492952..e3ac4ddd7 100644 --- a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx +++ b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.spec.tsx @@ -168,6 +168,13 @@ describe('', () => { }, }; + const mutatedDownloadAttachment = { + ...styleSet.downloadAttachment, + }; + mutatedDownloadAttachment['& > a']['& > .details']['& > .name'].color = '#fff'; + mutatedDownloadAttachment['& > a']['& > .icon'].fill = '#fff'; + styleSet.downloadAttachment = mutatedDownloadAttachment; + expect(webChat.exists()).toBe(true); const wcProps = webChat.props(); expect(wcProps.bot).toEqual({ id: defaultDocument.botId, name: 'Bot' }); diff --git a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx index ba46fb08d..e52126482 100644 --- a/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx +++ b/packages/app/client/src/ui/editor/emulator/parts/chat/chat.tsx @@ -65,6 +65,19 @@ interface ChatState { highlightedActivities?: Activity[]; } +const updateDownloadAttachmentStyle = downloadAttachment => { + try { + const mutatedDownloadAttachment = { + ...downloadAttachment, + }; + mutatedDownloadAttachment['& > a']['& > .details']['& > .name'].color = styles.bubbleContentColor; + mutatedDownloadAttachment['& > a']['& > .icon'].fill = styles.bubbleContentColor; + return mutatedDownloadAttachment; + } catch { + return downloadAttachment; + } +}; + export class Chat extends PureComponent { public state = { waitForSpeechToken: false } as ChatState; private activityMap: { [activityId: string]: Activity } = {}; @@ -87,17 +100,18 @@ export class Chat extends PureComponent { const styleSet = createStyleSet({ ...webChatStyleOptions, hideSendBox: isDisabled }); + // Overriding default styles of webchat as these properties are not exposed directly styleSet.uploadButton = { ...styleSet.uploadButton, padding: '1px', }; - styleSet.uploadAttachment = { ...styleSet.uploadAttachment, '& > .name, & > .size': { color: styles.bubbleContentColor, }, }; + styleSet.downloadAttachment = updateDownloadAttachmentStyle(styleSet.downloadAttachment); if (directLine) { const bot = {