diff --git a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-chromium-darwin.png b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-chromium-darwin.png index 529a8b9a3..0ae0833a9 100644 Binary files a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-chromium-darwin.png and b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-chromium-darwin.png differ diff --git a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-firefox-darwin.png b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-firefox-darwin.png index 1d3d96bcf..be2707591 100644 Binary files a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-firefox-darwin.png and b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-2-firefox-darwin.png differ diff --git a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-chromium-darwin.png b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-chromium-darwin.png index 50d29846c..040dda00e 100644 Binary files a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-chromium-darwin.png and b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-chromium-darwin.png differ diff --git a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-firefox-darwin.png b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-firefox-darwin.png index 08959ae57..a291bbe1e 100644 Binary files a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-firefox-darwin.png and b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-3-firefox-darwin.png differ diff --git a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-chromium-darwin.png b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-chromium-darwin.png index 85527d14c..2c2c77a9a 100644 Binary files a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-chromium-darwin.png and b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-chromium-darwin.png differ diff --git a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-firefox-darwin.png b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-firefox-darwin.png index 5cf2a8bd2..17ac07da0 100644 Binary files a/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-firefox-darwin.png and b/__visual_tests__/__snapshots__/workflow-tests.spec.ts/104-4-firefox-darwin.png differ diff --git a/src/components/ParsedBotMessageBody.tsx b/src/components/ParsedBotMessageBody.tsx index 706b56c70..6203ca69e 100644 --- a/src/components/ParsedBotMessageBody.tsx +++ b/src/components/ParsedBotMessageBody.tsx @@ -1,3 +1,4 @@ +import { css } from '@linaria/core'; import { lazy, Suspense } from 'react'; import styled from 'styled-components'; @@ -12,13 +13,17 @@ type Props = { sources?: Source[]; }; -const TextContainer = styled.div` - width: inherit; - text-align: start; +const textContainerStyle = css` word-break: break-word; - padding: 8px 12px; - gap: 12px; white-space: pre-wrap; + padding: 0 12px; // apply side padding of the bubble +`; + +const Container = styled.div` + padding: 8px 0; // Bubble top and bottom padding. Side padding is applied for token containers. + border-radius: 16px; + overflow: auto; + background-color: ${({ theme }) => theme.bgColor.incomingMessage}; `; /** @@ -30,14 +35,10 @@ export default function ParsedBotMessageBody(props: Props) { const { text, tokens, sources } = props; return ( - - {text} - - } - > - - + + {text}}> + + + ); } diff --git a/src/components/TokensBody.tsx b/src/components/TokensBody.tsx index 19d0cd0c9..0525b40bd 100644 --- a/src/components/TokensBody.tsx +++ b/src/components/TokensBody.tsx @@ -1,3 +1,4 @@ +import { cx } from '@linaria/core'; import DOMPurify from 'dompurify'; import Markdown from 'markdown-to-jsx'; import styled from 'styled-components'; @@ -13,6 +14,7 @@ import './markdown.scss'; type TokensBodyProps = { tokens: Token[]; sources?: Source[]; + className?: string; }; const BlockContainer = styled.div` @@ -24,23 +26,16 @@ const BlockContainer = styled.div` margin: 0.5em 0; `; -const MultipleTokenTypeContainer = styled.div` - padding: 8px 0; // Bubble top and bottom padding. Side padding is applied for token containers. - border-radius: 16px; - overflow: auto; - background-color: ${({ theme }) => theme.bgColor.incomingMessage}; -`; - -export default function TokensBody({ tokens, sources }: TokensBodyProps) { +export default function TokensBody({ tokens, sources, className }: TokensBodyProps) { const { enableSourceMessage } = useConstantState(); return ( - + <> {tokens.map((token: Token, i) => { // Normal text part of the message. if (token.type === TokenType.string) { return ( -
+
{ @@ -95,6 +90,6 @@ export default function TokensBody({ tokens, sources }: TokensBodyProps) {
) : null} - + ); } diff --git a/src/components/markdown.scss b/src/components/markdown.scss index a9fafdc78..81c3a689f 100644 --- a/src/components/markdown.scss +++ b/src/components/markdown.scss @@ -1,7 +1,3 @@ -.widget-markdown { - padding: 0 12px; /* apply side padding of the bubble */ -} - .widget-markdown * { color: var(--sb-on-content-inverse-1); }