Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 15 additions & 1 deletion packages/module/src/MessageBox/MessageBox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,28 @@
}

@media screen and (min-width: 64rem) {
.pf-chatbot--embedded,
.pf-chatbot--drawer,
.pf-chatbot--fullscreen {
.pf-chatbot__messagebox {
max-width: 60rem;
width: 100%;
}
}

/*
* Moves the scrollbar; see https://github.com/opendatahub-io/odh-dashboard/pull/8199
*/
.pf-chatbot--embedded .pf-chatbot__messagebox.pf-chatbot__messagebox--outer-scroll {
width: 100%;
max-width: unset;
align-items: center;
}

.pf-chatbot--embedded .pf-chatbot__messagebox.pf-chatbot__messagebox--outer-scroll > *:not(.pf-chatbot__messagebox-announcement) {
max-width: 60rem;
width: 100%;
}

}

.pf-chatbot.pf-m-compact {
Expand Down
11 changes: 10 additions & 1 deletion packages/module/src/MessageBox/MessageBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from 'react';
import JumpButton from './JumpButton';
import { ButtonProps, getResizeObserver, TooltipProps } from '@patternfly/react-core';
import { css } from '@patternfly/react-styles';

export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
/** Content that can be announced, such as a new message, for screen readers */
Expand Down Expand Up @@ -47,6 +48,8 @@ export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
jumpButtonTopTooltipProps?: TooltipProps;
/** Props passed to top jump button tooltip */
jumpButtonBottomTooltipProps?: TooltipProps;
/** Whether scrollbar is on the page or message box in embedded mode */
hasOuterScrollbar?: boolean;
}

export interface MessageBoxHandle extends HTMLDivElement {
Expand Down Expand Up @@ -115,6 +118,7 @@ export const MessageBox = forwardRef(
jumpButtonBottomProps,
jumpButtonBottomTooltipProps,
jumpButtonTopTooltipProps,
hasOuterScrollbar = false,
...props
}: MessageBoxProps,
ref: ForwardedRef<MessageBoxHandle | null>
Expand Down Expand Up @@ -433,7 +437,12 @@ export const MessageBox = forwardRef(
role="region"
tabIndex={0}
aria-label={ariaLabel}
className={`pf-chatbot__messagebox ${position === 'bottom' ? 'pf-chatbot__messagebox--bottom' : ''} ${className ?? ''}`}
className={css(
'pf-chatbot__messagebox',
position === 'bottom' && 'pf-chatbot__messagebox--bottom',
hasOuterScrollbar && 'pf-chatbot__messagebox--outer-scroll',
className
)}
ref={messageBoxRef}
{...props}
{...(enableSmartScroll ? { ...smartScrollHandlers } : {})}
Expand Down
Loading