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

Implement navigation/side drawer component #729

Open
joelzwarrington opened this issue Oct 8, 2021 · 1 comment
Open

Implement navigation/side drawer component #729

joelzwarrington opened this issue Oct 8, 2021 · 1 comment

Comments

@joelzwarrington
Copy link
Contributor

There are many cases where we'd need to display a drawer like component similar to ones present in Atlantis:

image

Could we implement something like this:

Prop Type Required
activator (Similar to menu component) React Component true
direction "left", "right", "top", "bottom" true
children React Children true
open boolean false
onDismissRequest (): void false
onOpenRequest (): void false
const [isOpen, setIsOpen] = useState(false);

return (
  <SideDrawer activator={<Button />} direction="left" open={isOpen} onOpenRequest={handleOpen} onDismissRequest={handleDismiss}>
    <h1>I am content inside the drawer</h1>
  <SideDrawer />
)

function handleOpen() {
  setIsOpen(true);
}

function handleDismiss() {
  setIsOpen(false);
}

on dismiss request would trigger when:

  • dismiss button clicked
  • drawer swiped away
  • clicked on area outside of dismiss button
  • escape key is pressed

The drawer would overlap content and be placed on-top and would slide in based on the direction.

Also would be good to have accessibility considered.

When on a mobile like/sized device, the drawer could take the entire page?

@joelzwarrington
Copy link
Contributor Author

@chris-at-jobber any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant