Skip to content

Commit

Permalink
Merge pull request #295 from rebeccaalpert/list-fix
Browse files Browse the repository at this point in the history
fix(TextMessage): Allow for more complex list output
  • Loading branch information
nicolethoen authored Nov 7, 2024
2 parents bc655e6 + 3985618 commit 3944512
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ export default MessageLoading;
* Item 2
* Item 3`;

const moreComplexList = `You may be wondering whether you can display more complex lists with formatting. In response to your question, I will explain how to spread butter on toast.
1. **Using a \`toaster\`:**
- Place \`bread\` in a \`toaster\`
- Once \`bread\` is lightly browned, remove from \`toaster\`
2. **Using a \`knife\`:**
Acquire 1 tablespoon of room temperature \`butter\`. Use \`knife\` to spread butter on \`toast\`. Bon appétit!
`;

return (
<>
<Message
Expand All @@ -60,6 +72,7 @@ export default MessageLoading;
<Message name="Bot" role="bot" avatar={patternflyAvatar} content={markdown} />
<Message name="Bot" role="bot" avatar={patternflyAvatar} content={orderedList} />
<Message name="Bot" role="bot" avatar={patternflyAvatar} content={unorderedList} />
<Message name="Bot" role="bot" avatar={patternflyAvatar} content={moreComplexList} />
<Message name="Bot" role="bot" avatar={patternflyAvatar} content="Example content" isLoading />
</>
);
Expand Down
12 changes: 8 additions & 4 deletions packages/module/src/Message/TextMessage/TextMessage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
// Chatbot Main - Message - Content - Text
// ============================================================================

.pf-chatbot__message-and-actions {
blockquote {
.pf-chatbot__message-text {
display: inline-block;
}
}
}

// Need to inline shorter text
.pf-chatbot__message-text {
width: fit-content;
Expand All @@ -16,10 +24,6 @@
--pf-v6-c-content--FontSize: var(--pf-t--chatbot--font-size);
}

p {
display: inline-block;
}

code {
background-color: var(--pf-t--chatbot-message--type--background--color--default);
font-size: var(--pf-t--global--font--size--body--default);
Expand Down
4 changes: 2 additions & 2 deletions packages/module/src/Message/TextMessage/TextMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { ExtraProps } from 'react-markdown';
import { Content, ContentVariants } from '@patternfly/react-core';

const TextMessage = ({ children, ...props }: JSX.IntrinsicElements['p'] & ExtraProps) => (
<div className="pf-chatbot__message-text">
<span className="pf-chatbot__message-text">
<Content component={ContentVariants.p} {...props}>
{children}
</Content>
</div>
</span>
);

export default TextMessage;

0 comments on commit 3944512

Please sign in to comment.