Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ export interface ModalBoxCloseButtonProps extends OUIAProps {
className?: string;
/** A callback for when the close button is clicked. */
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
/** Accessible descriptor of the close button. */
'aria-label'?: string;
/** Value to set the data-ouia-component-id.*/
ouiaId?: number | string;
}

export const ModalBoxCloseButton: React.FunctionComponent<ModalBoxCloseButtonProps> = ({
className,
onClose = () => undefined as any,
'aria-label': ariaLabel = 'Close',
ouiaId,
...props
}: ModalBoxCloseButtonProps) => (
<div className={css(styles.modalBoxClose, className)}>
<Button
variant="plain"
onClick={(event) => onClose(event)}
aria-label="Close"
aria-label={ariaLabel}
{...(ouiaId && { ouiaId: `${ouiaId}-${ModalBoxCloseButton.displayName}` })}
{...props}
>
Expand Down