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

Update modals #275

Merged
merged 56 commits into from Nov 7, 2019
Merged

Conversation

RobertBolender
Copy link
Contributor

@RobertBolender RobertBolender commented Oct 28, 2019

Spec:

Resolves #265

Consumers can opt-in to the new v6 Modal API by importing from:
import { Modal } from @faithlife/styled-ui/v6

Deprecation warnings have been added to inform users of the new API. The /v6 entrypoint will continue to be supported (with a deprecation warning) throughout the lifetime of v6 and won't be removed until v7 is released. This will ensure plenty of time for a smooth transition.


BREAKING CHANGES:

  1. ModalContent no longer has overflow-y: auto by default. Consumers who want their modal content to scroll should add it themselves. <ModalContent> accepts a overflowY styled-system prop.
    This decision has been reversed.

  2. ModalHeader no longer has a bottom-border. ModalContent no longer has vertical padding by default.

  3. Modals that are rendered without a ModalFooter may need to specify bottom padding on their ModalContent, unless they don't want it (such as for the fullscreen SmartMediaEditor, for example).

  4. Removed the unused tabindex option from modal footer buttons. (zero active uses at this time)

@korbinancell
Copy link
Contributor

While you are poking around could I request adding a boolean isDisabled to the footerProps buttons object. Currently you have to supply a custom footer just to disable a button.

Robert Bolender added 4 commits October 29, 2019 11:38
Consumers who want it can still add it with the styled-system overflowY prop.
Because FLCOM unconditionally adds `padding: 1em 0;` to all <p> tags.
@RobertBolender
Copy link
Contributor Author

RobertBolender commented Oct 31, 2019

Looks like the DefaultModalFooter already supports disabling the buttons with a prop, we just don't call it out on the propTypes for the Modal. I'll add it in this PR.

disabled: PropTypes.bool,

@RobertBolender RobertBolender marked this pull request as ready for review October 31, 2019 23:24
Robert Bolender added 3 commits November 4, 2019 16:32
Still a work in progress, this component is actually identical to the v5 LegacyModal.
components/utils/deprecate.js Outdated Show resolved Hide resolved
components/utils/deprecate.js Outdated Show resolved Hide resolved
components/utils/deprecate.js Outdated Show resolved Hide resolved
components/utils/deprecate.js Outdated Show resolved Hide resolved
components/modal/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@bryanrsmith bryanrsmith left a comment

Choose a reason for hiding this comment

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

👏 Nice cleanup @RobertBolender.

components/modal/modal-footer-buttons.jsx Show resolved Hide resolved
components/modal/modal-header.jsx Outdated Show resolved Hide resolved
onClose,
children,
theme,
styleOverrides,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the v6 API? We should remove this prop, if so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like we were only using it for zIndex, which is available as a styled-system prop. I'll add a deprecation notice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, we had been passing the zIndex style-override to the backdrop, which we are otherwise not exposing to the consumer.
How would you feel about adding an explicit zIndex prop to the Modal that would be passed to the Backdrop instead? I can't think of a scenario where you would want to set the zIndex on the Modal itself in a way that wouldn't affect the Backdrop.

@@ -0,0 +1,30 @@
import React from 'react';

var hits = new Set();
Copy link
Contributor

Choose a reason for hiding this comment

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

Still have that var :-)

We should figure out why this is allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eslint-config-faithlife has prefer-const enabled but not no-var
https://eslint.org/docs/rules/no-var#require-let-or-const-instead-of-var-no-var

components/modal/modal-footer-buttons.jsx Outdated Show resolved Hide resolved
components/modal/modal-footer-buttons.jsx Show resolved Hide resolved
Robert Bolender added 5 commits November 6, 2019 13:35
This should result in fewer surprises for consumers.
Focus styles for input elements should not be cut off from the
Modal.Content, and overflow content should scroll when expected to.
Robert Bolender added 5 commits November 6, 2019 13:59
React SSR does not support hydrating Portals, so when we create a Portal
we do so within a useEffect that will only run in the browser.

Functionality isn't changing in this commit, we're just making the code
a little clearer.
@RobertBolender RobertBolender merged commit a4f9655 into Faithlife:master Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[RFD] Update to modals
3 participants