Skip to content

Commit 771f278

Browse files
committed
udpate variant, update to use tokens, update background
1 parent 21511ff commit 771f278

5 files changed

Lines changed: 19 additions & 18 deletions

File tree

packages/module/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDividers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ export const MessageWithDividersExample: FunctionComponent = () => (
1111
avatar={patternflyAvatar}
1212
content={`This is a text-based message from a bot named "Bot."`}
1313
/>
14-
<MessageDivider variant="date" content="1 hour ago" />
14+
<MessageDivider variant="inset" content="1 hour ago" />
1515
<Message
1616
name="Bot"
1717
role="bot"
1818
avatar={patternflyAvatar}
1919
content={`This is a text-based message from "Bot," with an updated timestamp.`}
2020
timestamp="1 hour ago"
2121
/>
22-
<MessageDivider variant="announcement" content="Agent joined the chat" />
22+
<MessageDivider variant="fullWidth" content="Agent joined the chat" />
2323
</>
2424
);

packages/module/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ You can further customize the avatar by applying an additional class or passing
7171

7272
To provide users with important contextual updates, you can add dividers between messages.
7373

74-
For example, you can use the default divider to announce that an agent has joined the chat, or you can pass `variant="date"` to a divider and display a "timestamp" for more significant gaps in the conversation.
74+
For example, you can use the default divider to display a "timestamp" for more significant gaps in the conversation, or you can pass `variant="fullWidth"` to a divider to announce that an agent has joined the chat.
7575

7676
```js file="./MessageWithDividers.tsx"
7777

packages/module/src/MessageDivider/MessageDivider.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
padding: 0px var(--pf-t--global--spacer--md);
1313
justify-content: center;
1414
align-items: center;
15-
gap: 8px;
15+
gap: var(--pf-t--global--spacer--sm);
1616
border-radius: var(--pf-t--global--border--radius--pill);
17-
background: var(--pf-t--global--background--color--tertiary--default);
17+
background-color: var(--pf-t--global--background--color--tertiary--default);
1818
}
1919

2020
.pf-chatbot__message-divider-text {
@@ -25,8 +25,8 @@
2525
font-weight: var(--pf-t--global--font--weight--body--bold);
2626
}
2727

28-
// Date variant
29-
.pf-chatbot__message-divider--date {
28+
// Inset variant
29+
.pf-chatbot__message-divider--inset {
3030
display: flex;
3131
align-items: center;
3232
justify-content: center;
@@ -41,12 +41,13 @@
4141
}
4242

4343
.pf-chatbot__message-divider-content {
44+
background-color: var(--pf-t--global--background--color--secondary--default);
4445
border: 1px solid var(--pf-t--global--border--color--default);
4546
max-width: 75%
4647
}
4748
}
4849

49-
// Announcement variant
50-
.pf-chatbot__message-divider--announcement .pf-chatbot__message-divider-content {
50+
// Full width variant
51+
.pf-chatbot__message-divider--full-width .pf-chatbot__message-divider-content {
5152
width: 100%;
5253
}

packages/module/src/MessageDivider/MessageDivider.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ describe('MessageDivider', () => {
1111
expect(screen.getByText(new Date().toLocaleDateString())).toBeInTheDocument();
1212
expect(screen.getByTestId('message-divider').children[0]).toHaveClass('pf-chatbot__message-divider--date');
1313
});
14-
it('should render date variant correctly', () => {
15-
render(<MessageDivider variant="date" content="test" data-testid="message-divider" />);
14+
it('should render inset variant correctly', () => {
15+
render(<MessageDivider variant="inset" content="test" data-testid="message-divider" />);
1616
expect(screen.getByText('test')).toBeInTheDocument();
1717
expect(screen.getByTestId('message-divider').children[0]).toHaveClass('pf-chatbot__message-divider--date');
1818
});
19-
it('should render announcement variant correctly', () => {
20-
render(<MessageDivider variant="announcement" content="test" data-testid="message-divider" />);
19+
it('should render fullWidth variant correctly', () => {
20+
render(<MessageDivider variant="fullWidth" content="test" data-testid="message-divider" />);
2121
expect(screen.getByText('test')).toBeInTheDocument();
2222
expect(screen.getByTestId('message-divider')).toHaveClass('pf-chatbot__message-divider--announcement');
2323
});

packages/module/src/MessageDivider/MessageDivider.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import type { FunctionComponent } from 'react';
55

66
export interface MessageDividerProps {
77
/** Variant of the divider */
8-
variant?: 'date' | 'announcement';
8+
variant?: 'inset' | 'fullWidth';
99
/** Content of the message divider */
1010
content?: string;
1111
}
1212

1313
const MessageDivider: FunctionComponent<MessageDividerProps> = ({
14-
variant = 'date',
14+
variant = 'inset',
1515
content = new Date().toLocaleDateString(),
1616
...props
1717
}: MessageDividerProps) => {
18-
if (variant === 'date') {
18+
if (variant === 'inset') {
1919
return (
2020
<div className="pf-chatbot__message-divider" {...props}>
21-
<div className="pf-chatbot__message-divider--date">
21+
<div className="pf-chatbot__message-divider--inset">
2222
<div className="pf-chatbot__message-divider-content">
2323
<div className="pf-chatbot__message-divider-text">{content}</div>
2424
</div>
@@ -28,7 +28,7 @@ const MessageDivider: FunctionComponent<MessageDividerProps> = ({
2828
}
2929

3030
return (
31-
<div className="pf-chatbot__message-divider pf-chatbot__message-divider--announcement" {...props}>
31+
<div className="pf-chatbot__message-divider pf-chatbot__message-divider--full-width" {...props}>
3232
<div className="pf-chatbot__message-divider-content">
3333
<div className="pf-chatbot__message-divider-text">{content}</div>
3434
</div>

0 commit comments

Comments
 (0)