Skip to content

Commit

Permalink
chore(ModalHeader): enable dynamic value
Browse files Browse the repository at this point in the history
  • Loading branch information
cf-remylenoir committed Dec 17, 2024
1 parent d5305b6 commit a4af0a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/components/modal/src/ModalHeader/ModalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ interface ModalHeaderInternalProps extends CommonProps {
subtitle?: string;
onClose?: Function;
children?: React.ReactNode;
aria?: {
closeIconLabel?: string;
};
}

export type ModalHeaderProps = PropsWithHTMLElement<
Expand All @@ -30,6 +33,7 @@ export const ModalHeader = ({
testId = 'cf-ui-modal-header',
className,
children,
aria,
...otherProps
}: ModalHeaderProps): React.ReactElement => {
const styles = getModalHeaderStyles();
Expand All @@ -55,7 +59,7 @@ export const ModalHeader = ({
<Flex alignItems="center" className={styles.buttonContainer}>
<IconButton
variant="transparent"
aria-label="Close"
aria-label={aria?.closeIconLabel || 'Close'}
size="small"
icon={<CloseIcon size="small" />}
onClick={() => {
Expand Down
3 changes: 3 additions & 0 deletions packages/components/modal/stories/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export const Basic: Story<ModalProps> = (props) => {
{...props}
modalHeaderProps={{
className: 'additional-modal-header-class',
aria: {
closeIconLabel: 'Custom close modal aria label',
},
}}
modalContentProps={{
className: 'additional-modal-content-class',
Expand Down

0 comments on commit a4af0a8

Please sign in to comment.