Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Modal): content spacing styles #8495

Closed
wants to merge 6 commits into from
Closed
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
31 changes: 19 additions & 12 deletions packages/components/src/components/modal/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
height: auto;
max-height: 90%;

.#{$prefix}--modal-header,
.#{$prefix}--modal-content,
.#{$prefix}--modal-content__regular-content {
.#{$prefix}--modal-header p,
.#{$prefix}--modal-content p,
.#{$prefix}--modal-content__regular-content p {
padding-right: 20%;
}

Expand Down Expand Up @@ -127,18 +127,25 @@
}

.#{$prefix}--modal-container--xs {
.#{$prefix}--modal-header {
.#{$prefix}--modal-header p {
padding-right: $carbon--spacing-09;
}

.#{$prefix}--modal-content,
.#{$prefix}--modal-content__regular-content,
.#{$prefix}--modal-content p,
.#{$prefix}--modal-content__regular-content p,
//TO-DO: remove all instances of --modal-content--with-form in v11 since hasForm prop has been deprecated
.#{$prefix}--modal-content--with-form {
padding-right: $spacing-05;
}

@include carbon--breakpoint(md) {
width: 48%;

.#{$prefix}--modal-header p,
.#{$prefix}--modal-content p,
.#{$prefix}--modal-content__regular-content p {
padding-right: $carbon--spacing-05;
}
}

@include carbon--breakpoint(lg) {
Expand Down Expand Up @@ -174,9 +181,9 @@
@include carbon--breakpoint(xlg) {
width: 36%;

.#{$prefix}--modal-header,
.#{$prefix}--modal-content,
.#{$prefix}--modal-content__regular-content {
.#{$prefix}--modal-header p,
.#{$prefix}--modal-content p,
.#{$prefix}--modal-content__regular-content p {
padding-right: 20%;
}

Expand All @@ -201,9 +208,9 @@
@include carbon--breakpoint(md) {
width: 96%;

.#{$prefix}--modal-header,
.#{$prefix}--modal-content,
.#{$prefix}--modal-content__regular-content {
.#{$prefix}--modal-header p,
.#{$prefix}--modal-content p,
.#{$prefix}--modal-content__regular-content p {
padding-right: 20%;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3342,9 +3342,7 @@ Map {
"type": "bool",
},
"focusTrap": [Function],
"hasForm": Object {
"type": "bool",
},
"hasForm": [Function],
"hasScrollingContent": Object {
"type": "bool",
},
Expand Down Expand Up @@ -4661,15 +4659,13 @@ Map {
"flags": Map {
"enable-css-custom-properties" => false,
"enable-use-controlled-state-with-value" => false,
"enable-css-grid" => false,
"enable-2021-release" => false,
},
},
"_currentValue2": FeatureFlagScope {
"flags": Map {
"enable-css-custom-properties" => false,
"enable-use-controlled-state-with-value" => false,
"enable-css-grid" => false,
"enable-2021-release" => false,
},
},
Expand Down
11 changes: 7 additions & 4 deletions packages/react/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ export default class Modal extends Component {
),

/**
* Provide whether the modal content has a form element.
* If `true` is used here, non-form child content should have `bx--modal-content__regular-content` class.
* Deprecated: Used to determine whether the modal content has a form element to adjust spacing,
* but now spacing styles account for all types of elements
*/
hasForm: PropTypes.bool,
hasForm: deprecate(
PropTypes.bool,
`\nThe prop \`hasForm\` for Modal has been deprecated, as the feature of \`hasForm\` runs by default.`
),

/**
* Specify whether the modal contains scrolling content
Expand Down Expand Up @@ -386,7 +389,7 @@ export default class Modal extends Component {
});

const contentClasses = classNames(`${prefix}--modal-content`, {
[`${prefix}--modal-content--with-form`]: hasForm,
[`${prefix}--modal-content--with-form`]: hasForm, //TO-DO: delete this line in v11 since hasForm is deprecated
[`${prefix}--modal-scroll-content`]: hasScrollingContent,
});

Expand Down