-
Notifications
You must be signed in to change notification settings - Fork 81
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 component #1622
feat: Modal component #1622
Conversation
… in parent Modal component
…eact-uswds into sr-1233-modal-component
return <Link<FCProps> {...linkProps} /> | ||
} | ||
|
||
const definitelyLinkProps = linkProps as DefaultLinkProps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to fix the Typescript error that we started seeing in this update - I'm not sure why the overload isn't correctly narrowing this type after the isCustomProps
check but I think that is a separate issue to resolve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small things, but looks great and works nicely from my testing!
Co-authored-by: Brandon Lenz <brandonalenz@gmail.com>
Summary
This PR adds the USWDS Modal component and adds all USWDS examples to Storybook, as well as some documentation around how to use the component.
I also added focus-trap-react for managing focus inside of modals (USWDS handles this in a util and it seemed like something better implemented with an existing lib).
I also added two components to use for toggling the modal that implement the guidelines suggested by USWDS for convenience:
ModalToggleButton
andModalOpenLink
. Consumers can also call the exposed reftoggleModal
method directly, so they are not restricted to these components.Related Issues or PRs
How To Test
document.body
. This is expected.Screenshots (optional)