Skip to content

Commit

Permalink
style(ComposedModal): add new classes to ComposedModal to fix alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Jan 9, 2024
1 parent a77afec commit d33112d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { isElement } from 'react-is';
import PropTypes, { ReactNodeLike } from 'prop-types';
import { ModalHeader, type ModalHeaderProps } from './ModalHeader';
import { ModalFooter, type ModalFooterProps } from './ModalFooter';

import cx from 'classnames';

import toggleClass from '../../tools/toggleClass';
Expand Down
25 changes: 17 additions & 8 deletions packages/react/src/components/ComposedModal/ModalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import PropTypes from 'prop-types';
import cx from 'classnames';
import { Close } from '@carbon/icons-react';
import { usePrefix } from '../../internal/usePrefix';
import { IconButton } from '../IconButton';

type DivProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'>;
export interface ModalHeaderProps extends DivProps {
Expand Down Expand Up @@ -127,14 +128,22 @@ export const ModalHeader = React.forwardRef<HTMLDivElement, ModalHeaderProps>(

{children}

<button
onClick={handleCloseButtonClick}
className={closeClass}
title={iconDescription}
aria-label={iconDescription}
type="button">
<Close size={20} className={closeIconClass} />
</button>
<div className={`${prefix}--modal-close-button`}>
<IconButton
className={closeClass}
label={iconDescription}
onClick={handleCloseButtonClick}
title={iconDescription}
aria-label={iconDescription}
align="left">
<Close
size={20}
aria-hidden="true"
tabIndex="-1"
className={closeIconClass}
/>
</IconButton>
</div>
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/styles/scss/components/modal/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
inset-block-start: 0;
inset-inline-end: 0;
}

.#{$prefix}--modal-close {
padding: convert.to-rem(12px);
border: 2px solid transparent;
Expand Down

0 comments on commit d33112d

Please sign in to comment.