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
7 changes: 7 additions & 0 deletions src/components/popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export interface PopoverProps {
* CSS class name(s) to apply to the Popover container
*/
className?: string;
/**
* Extra attributes forwarded directly to the popover content panel.
* Use this to pass `data-*` attributes without polluting the component's own props.
*/
contentProps?: Record<string, string>;
/**
* Optional text content of a subtle paragraph, for the body of the Popover
*/
Expand Down Expand Up @@ -106,6 +111,7 @@ export const PopoverRoot = forwardRef<HTMLButtonElement, PopoverProps>((props, r
align,
children,
className,
contentProps,
description,
disableOutsideClick,
extraContent,
Expand All @@ -129,6 +135,7 @@ export const PopoverRoot = forwardRef<HTMLButtonElement, PopoverProps>((props, r
<RadixPopover.Portal>
<PopoverContent
{...themeOverrideProp}
{...contentProps}
Comment thread
jeremy-davis-sonarsource marked this conversation as resolved.
align={align}
arrowPadding={OVERLAY_ARROW_PADDING}
className={className}
Expand Down
9 changes: 7 additions & 2 deletions src/components/teaching-bubble/TeachingBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import {
} from '~common/helpers/constants';
import { Popover, PopoverProps } from '../popover';

type SelectedPopoverProps = Omit<PopoverProps, 'isOpen' | 'onOpenChange' | 'disableOutsideClick'>;
type SelectedPopoverProps = Omit<
PopoverProps,
'isOpen' | 'onOpenChange' | 'disableOutsideClick' | 'contentProps'
>;
type RequiredPopoverProps = Required<Pick<PopoverProps, 'isOpen'>>;

export interface TeachingBubbleProps extends SelectedPopoverProps, RequiredPopoverProps {
Expand All @@ -52,8 +55,10 @@ export function TeachingBubbleRoot(props: Readonly<TeachingBubbleProps>) {

return (
<StyledPopover
{...{ [FEATURE_COMMUNICATION_DATA_ATTRIBUTE]: FeatureCommunicationComponent.TeachingBubble }}
{...popoverProps}
contentProps={{
[FEATURE_COMMUNICATION_DATA_ATTRIBUTE]: FeatureCommunicationComponent.TeachingBubble,
}}
Comment thread
jeremy-davis-sonarsource marked this conversation as resolved.
disableOutsideClick
isOpen={isOpen}
onOpenChange={handleClose}
Expand Down
Loading