Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TextMessage): Allow for more complex list output #295

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 butter toast.
rebeccaalpert marked this conversation as resolved.
Show resolved Hide resolved

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 appetit!
rebeccaalpert marked this conversation as resolved.
Show resolved Hide resolved
`;

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;
Loading