-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ListMessage): Add component to render lists appropriately
React-Markdown renders lists for us, but we weren't getting PatternFly styles applied. This will render the appropriate components.
- Loading branch information
1 parent
6ea3950
commit 9e35f65
Showing
8 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/module/src/Message/ListMessage/ListItemMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ============================================================================ | ||
// Chatbot Main - Message - Content - List | ||
// ============================================================================ | ||
|
||
import React from 'react'; | ||
import { ExtraProps } from 'react-markdown'; | ||
import { ListItem } from '@patternfly/react-core'; | ||
|
||
const ListItemMessage = ({ children }: JSX.IntrinsicElements['li'] & ExtraProps) => <ListItem>{children}</ListItem>; | ||
|
||
export default ListItemMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ============================================================================ | ||
// Chatbot Main - Message - Content - Text | ||
// ============================================================================ | ||
|
||
.pf-chatbot__message-ordered-list, | ||
.pf-chatbot__message-unordered-list { | ||
width: fit-content; | ||
padding: var(--pf-t--chatbot-message--type--padding) 0 var(--pf-t--chatbot-message--type--padding) 0; | ||
border-radius: var(--pf-t--chatbot-message--type--border--radius); | ||
|
||
.pf-v6-c-list, | ||
ul, | ||
li { | ||
font-size: var(--pf-t--chatbot--font-size); | ||
} | ||
} | ||
|
||
.pf-chatbot__message--user { | ||
.pf-chatbot__message-ordered-list, | ||
.pf-chatbot__message-unordered-list { | ||
background-color: var(--pf-t--chatbot-message--type--background--color--primary); | ||
color: var(--pf-t--chatbot-message--type--text--color--primary); | ||
padding: var(--pf-t--chatbot-message--type--padding); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/module/src/Message/ListMessage/OrderedListMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// ============================================================================ | ||
// Chatbot Main - Message - Content - List | ||
// ============================================================================ | ||
|
||
import React from 'react'; | ||
import { ExtraProps } from 'react-markdown'; | ||
import { List, ListComponent, OrderType } from '@patternfly/react-core'; | ||
|
||
const OrderedListMessage = ({ children }: JSX.IntrinsicElements['ol'] & ExtraProps) => ( | ||
<div className="pf-chatbot__message-ordered-list"> | ||
<List component={ListComponent.ol} type={OrderType.number}> | ||
{children} | ||
</List> | ||
</div> | ||
); | ||
|
||
export default OrderedListMessage; |
15 changes: 15 additions & 0 deletions
15
packages/module/src/Message/ListMessage/UnorderedListMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// ============================================================================ | ||
// Chatbot Main - Message - Content - List | ||
// ============================================================================ | ||
|
||
import React from 'react'; | ||
import { ExtraProps } from 'react-markdown'; | ||
import { List } from '@patternfly/react-core'; | ||
|
||
const UnorderedListMessage = ({ children }: JSX.IntrinsicElements['ul'] & ExtraProps) => ( | ||
<div className="pf-chatbot__message-unordered-list"> | ||
<List>{children}</List> | ||
</div> | ||
); | ||
|
||
export default UnorderedListMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters