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

Feature/rui modal #51

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Feature/rui modal #51

wants to merge 22 commits into from

Conversation

jnelssonsmith
Copy link
Contributor

@jnelssonsmith jnelssonsmith commented Jul 25, 2019

Changes

  • Adds a new modal component
  • new @rhythm-ui/a11y-utils package that contains the new FocusTrap helper class
  • FocusTrap class, that creates and manages a focus trap
  • new @rhythm-ui/utils package that contains generate UUID function

@jnelssonsmith
Copy link
Contributor Author

cc @ttaiyo @jeffdowdle

Please see above draft PR for initial Modal core logic and Focus Trap implementation

@jnelssonsmith jnelssonsmith changed the title [WIP] Feature/rui modal Feature/rui modal Aug 4, 2019
@jnelssonsmith jnelssonsmith marked this pull request as ready for review August 4, 2019 04:07
--rui-modal__actions-margin: 10px 0;

/**
* @variable Actions section padding
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add alignment to the action box, and allow the user to configure these buttons to be aligned left/center/right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add styling hook for alignment :)

www/package.json Outdated
@@ -34,13 +34,21 @@
"@mdx-js/mdx": "^1.0.0-rc.4",
"@mdx-js/react": "^1.0.0-rc.5",
"@rhythm-ui/button-react": "^1.0.0",
"@rhythm-ui/modal-react": "^1.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

1 import is sufficient ;) (I think this is a generator issue as I've seen it elsewhere as well)


.modal__heading > ::slotted([slot="heading"]) {
margin: 0;
font-size: 22px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we set fonts here instead of just relying on the users configuration for default text tags? Should we remove this? (or at least make it configurable)

}

.modal__detail > ::slotted([slot="detail"]) {
font-size: 16px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment as the heading, should be set by core css for text tags

* The size of the modal
*/
@property({type: String})
public size: 'small' | 'medium' | 'fullscreen' = 'small';
Copy link
Collaborator

Choose a reason for hiding this comment

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

would prefer to use large over fullscreen here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ricominten I think fullscreen makes sense here as it is styled to take up the full screen - so I don't agree with renaming it to large. Would adding a 3rd 'large' variant be okay instead?

<div slot="detail">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis.</p>
</div>
<rui-button slot="confirm">Confirm</rui-button>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to make a more generic action slot and just given them onClick events handlers? We have a current use-case where we have 3 action items in a modal and this solution would not support that.

</rui-modal>
```

<rui-button onClick={() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move these buttons inside the preview so that you can see how to open the modals?

@ricominten
Copy link
Collaborator

@jnelssonsmith @jennasalau It might be worth looking into this for the behaviour of our focus trap: https://github.com/WICG/inert

@ricominten
Copy link
Collaborator

#58

@ricominten ricominten changed the base branch from rhythm-ui-mk-2 to master September 6, 2019 09:34
# Conflicts:
#	www/package.json
#	www/src/templates/Component/Component.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants