From 197282d0bf78e5632a5b57862748b14c29a68738 Mon Sep 17 00:00:00 2001 From: Rebecca Alpert Date: Tue, 5 Nov 2024 15:08:42 -0500 Subject: [PATCH 1/3] fix(Message): Truncate very long names --- .../virtual-assistant/examples/Messages/BotMessage.tsx | 7 +++++++ packages/module/src/Message/Message.scss | 9 +++++++++ packages/module/src/Message/Message.tsx | 8 ++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/module/patternfly-docs/content/extensions/virtual-assistant/examples/Messages/BotMessage.tsx b/packages/module/patternfly-docs/content/extensions/virtual-assistant/examples/Messages/BotMessage.tsx index 969e19c0..0045b476 100644 --- a/packages/module/patternfly-docs/content/extensions/virtual-assistant/examples/Messages/BotMessage.tsx +++ b/packages/module/patternfly-docs/content/extensions/virtual-assistant/examples/Messages/BotMessage.tsx @@ -74,6 +74,13 @@ export default MessageLoading; + + ); }; diff --git a/packages/module/src/Message/Message.scss b/packages/module/src/Message/Message.scss index f53f6b8d..6b694c76 100644 --- a/packages/module/src/Message/Message.scss +++ b/packages/module/src/Message/Message.scss @@ -15,6 +15,12 @@ gap: var(--pf-t--global--spacer--lg); padding-bottom: var(--pf-t--global--spacer--2xl); + // Name + // -------------------------------------------------------------------------- + .pf-v6-c-truncate { + --pf-v6-c-truncate--MinWidth: 0ch; + --pf-v6-c-truncate__start--MinWidth: 0ch; + } // Avatar // -------------------------------------------------------------------------- .pf-v6-c-avatar { @@ -61,6 +67,9 @@ } // Timestamp + .pf-v6-c-timestamp { + flex: 1 0 max-content; + } time { font-size: var(--pf-t--global--font--size--xs); } diff --git a/packages/module/src/Message/Message.tsx b/packages/module/src/Message/Message.tsx index 6f8f07ff..9a962daa 100644 --- a/packages/module/src/Message/Message.tsx +++ b/packages/module/src/Message/Message.tsx @@ -6,7 +6,7 @@ import React from 'react'; import Markdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; -import { Avatar, Label, LabelGroup, LabelGroupProps, LabelProps, Timestamp } from '@patternfly/react-core'; +import { Avatar, Label, LabelGroup, LabelGroupProps, LabelProps, Timestamp, Truncate } from '@patternfly/react-core'; import MessageLoading from './MessageLoading'; import CodeBlockMessage from './CodeBlockMessage/CodeBlockMessage'; import TextMessage from './TextMessage/TextMessage'; @@ -116,7 +116,11 @@ export const Message: React.FunctionComponent = ({
- {name} + {name && ( + + + + )} {role === 'bot' && (