Skip to content

Commit

Permalink
Dialog: add style prop
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytroshch committed Aug 24, 2023
1 parent ca3523f commit 3b51095
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/core/src/components/ui/Dialog/Dialog.Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Modal = forwardRef(({
width,
height,
textAlign,
style,
}, ref) => {
const titleRef = useRef()
return (
Expand All @@ -47,7 +48,9 @@ const Modal = forwardRef(({
'is-mobile-fullscreen': isFullscreenInMobile,
})}
ref={ref}
style={{ maxWidth: width, height, textAlign }}
style={{
maxWidth: width, height, textAlign, ...style,
}}
>
{title && (
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
Expand Down Expand Up @@ -137,6 +140,11 @@ Modal.propTypes = {
* Need to disable if modal contains iframe, to avoid conflicts
*/
isFocusTrapEnabled: PropTypes.bool.isRequired,
/**
* Style object of the Modal
*/
// eslint-disable-next-line react/forbid-prop-types
style: PropTypes.object,
}

Modal.defaultProps = {
Expand All @@ -150,6 +158,7 @@ Modal.defaultProps = {
width: 460,
height: 'auto',
textAlign: 'center',
style: {},
}

export default Modal
8 changes: 8 additions & 0 deletions packages/core/src/components/ui/Dialog/Dialog.Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const Dialog = forwardRef(function Dialog(props, ref) {
height,
textAlign,
isFocusTrapEnabled,
style,
} = props

useEffect(() => {
Expand Down Expand Up @@ -77,6 +78,7 @@ const Dialog = forwardRef(function Dialog(props, ref) {
width={width}
height={height}
textAlign={textAlign}
style={style}
>
{children}
</Modal>
Expand Down Expand Up @@ -166,6 +168,11 @@ Dialog.propTypes = {
* Need to disable if modal contains iframe, to avoid conflicts
*/
isFocusTrapEnabled: PropTypes.bool,
/**
* Style object of the Modal
*/
// eslint-disable-next-line react/forbid-prop-types
style: PropTypes.object,
}

Dialog.defaultProps = {
Expand All @@ -182,6 +189,7 @@ Dialog.defaultProps = {
height: 'auto',
textAlign: 'center',
onSubmit: () => {},
style: {},
}

export default Dialog

0 comments on commit 3b51095

Please sign in to comment.