Skip to content

Commit f4cfc9a

Browse files
feat(ChatbotContent): Add variant with white background (#689)
This was a request from OpenShift AI - they are looking for more flexibility in complex embedded layouts.
1 parent 9efa451 commit f4cfc9a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/module/src/ChatbotContent/ChatbotContent.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
@media screen and (max-height: 518px) {
1313
overflow: unset;
1414
}
15+
16+
&.pf-m-primary {
17+
background-color: var(--pf-t--global--background--color--primary--default);
18+
}
1519
}
1620

1721
// ============================================================================

packages/module/src/ChatbotContent/ChatbotContent.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ describe('ChatbotContent', () => {
1111
const { container } = render(<ChatbotContent className="custom-class">Chatbot Content</ChatbotContent>);
1212
expect(container.querySelector('.custom-class')).toBeTruthy();
1313
});
14+
15+
it('should render ChatbotContent with primary class', () => {
16+
const { container } = render(<ChatbotContent isPrimary>Chatbot Content</ChatbotContent>);
17+
expect(container.querySelector('.pf-m-primary')).toBeTruthy();
18+
});
1419
});

packages/module/src/ChatbotContent/ChatbotContent.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ export interface ChatbotContentProps extends HTMLProps<HTMLDivElement> {
88
children: React.ReactNode;
99
/** Custom classname for the ChatbotContent component */
1010
className?: string;
11+
/** Sets background color to primary */
12+
isPrimary?: boolean;
1113
}
1214

1315
export const ChatbotContent: FunctionComponent<ChatbotContentProps> = ({
1416
children,
1517
className,
18+
isPrimary,
1619
...props
1720
}: ChatbotContentProps) => (
18-
<div className={`pf-chatbot__content ${className ?? ''}`} {...props}>
21+
<div className={`pf-chatbot__content ${isPrimary ? 'pf-m-primary' : ''} ${className ?? ''}`} {...props}>
1922
{children}
2023
</div>
2124
);

0 commit comments

Comments
 (0)