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

feat(modal): introduce size variants #4657

Merged
merged 9 commits into from
Nov 14, 2019

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Nov 12, 2019

Refs #4607.

Changelog

New

  • Size variants, with bx--modal-container--xs, bx--modal-container--sm and bx--modal-container--lg classes (enabled via size prop of <Modal>/<ComposedModal>).
  • bx--modal-content--with-form class (enabled via hasForm prop of <Modal>/<ModalBody>), which removes the right margin. Non-form contents in there should use bx--modal-content__regular-content class.
  • The UI in modal content for scroll overflow.

Changed

  • Modal sizes with different variants with different breakpoints.

Testing / Reviewing

Testing should make sure our modal is not broken.

@netlify
Copy link

netlify bot commented Nov 12, 2019

Deploy preview for the-carbon-components ready!

Built with commit d7d00f7

https://deploy-preview-4657--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Nov 12, 2019

Deploy preview for carbon-components-react ready!

Built with commit d7d00f7

https://deploy-preview-4657--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Nov 12, 2019

Deploy preview for carbon-elements ready!

Built with commit d7d00f7

https://deploy-preview-4657--carbon-elements.netlify.com

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

widths, max-height, and right padding looks good to me at all breakpoints for all variants

I think we can increase the height of the overflow fade a little or position it a little higher maybe, but will defer to design on this

image

do we also need to implement logic that removes the overflow indicator when the user has scrolled to the bottom of the content?

.#{$prefix}--modal-header,
.#{$prefix}--modal-content,
.#{$prefix}--modal-content__regular-content {
padding-right: rem(16px);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use a spacing token here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see: #4657 (comment)

Still a good catch, though, as the code I referred to doesn't use rem() function. Rectified at: 164817e

}

.#{$prefix}--modal-content--with-form {
padding-right: 1rem;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use a spacing token here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the modal content historically uses fixed size: https://github.com/carbon-design-system/carbon/blob/v10.7.0/packages/components/src/components/modal/_modal.scss#L100

@aagonzales Do you think it's token-based instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Margin-right is the special one because sometimes its 20%. I leave it up to dev to decide if its better to use 1rem or spacing-05.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aagonzales for your response - Updated with spacing tokens.

padding-right: 1rem;

@include carbon--breakpoint(xlg) {
padding-right: 1rem; // Override for `.#{$prefix}--modal-content`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use a spacing token here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was referring to the carbon--spacing tokens, I think we can use $spacing-05 right?

packages/react/src/components/Modal/Modal.js Outdated Show resolved Hide resolved
packages/react/src/components/Modal/Modal.js Outdated Show resolved Hide resolved
Copy link
Member

@aagonzales aagonzales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

  • There appears to be a max-width being applied at 768px. Large, small and default are all showing at the same size when on my large display. They should still be rendering at different widths on a large display.
  • Agreed with Andrew about the overflow-indicator. Let's give it a height of 32px instead of 16.
  • Margin-right on modals less the 448px should only be 16px instead of 20%

@asudoh
Copy link
Contributor Author

asudoh commented Nov 13, 2019

Thank you for reviewing @aagonzales - Removed the max-width thing, increased the height of overflow indicator, and fixed margin-rights.

Copy link
Member

@aagonzales aagonzales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size variants look good to me now!

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thanks for making the changes

Copy link
Contributor

@abbeyhrt abbeyhrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 🎉

@asudoh asudoh merged commit 3994637 into carbon-design-system:master Nov 14, 2019
@asudoh asudoh deleted the modal-sizes branch November 14, 2019 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants