Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

AP-1335 Implement Menus #153

Merged
merged 3 commits into from
Feb 4, 2020
Merged

AP-1335 Implement Menus #153

merged 3 commits into from
Feb 4, 2020

Conversation

justinanastos
Copy link
Contributor

@justinanastos justinanastos commented Jan 24, 2020

Contributes to https://apollographql.atlassian.net/browse/AP-1335

Intent

Create a menu system based on https://zpl.io/adX0ELe. Check the examples in the storybook docs to see how to compose menus together!

Uses tippy.js under the hood, just like our tooltips.

This has a bug that can't be fixed until atomiks/tippyjs#678 lands sometime in February. Popper v1 can't reliably figure out the boundaries of a tooltip nested below a component using overflow scrolling. This is resolved in popper v2; but that's not yet included in tippy because it's a breaking change. Fortunately the project maintainers are the same people so they're working on it.

It was a challenge to make the content scrollable if it overflowed the container, but that's included.

Tests

There aren't any. If you can think of any worth adding, I'd love to!

Multilevel Menus

These are supported out of the box with the underlying tippy.js library; we just haven't implemented it here yet, which is fine.

Details

This includes these new components:

  • Menu

    The parent of a menu. Nesting doesn't work yet; we'll follow up with that if/when we need it. Tippy does support it, we just have to set it up.

  • MenuItem

    Item in the menu

  • MenuHeader

    Heading for a menu. Composed from MenuItem to inherit it's styles

  • MenuDivider

    For divided menus

  • MenuIconSize

    This is not exported but used internally so you can set the menu size on a Menu and then use context to access the desired menu size for all children.

Release Notes

Create new Menu component and supporting components MenuItem, MenuHeader, and MenuDivider.

See https://zpl.io/adX0ELe for the original designs and the storybook docs page for usage instructions and examples.

This does not include any tests because I didn't know what to test. Any tests or ideas for tests would be most welcome!

@justinanastos justinanastos force-pushed the justin/AP-1335/menus branch 3 times, most recently from 2bed45d to e21ebdd Compare January 30, 2020 14:38
@justinanastos justinanastos changed the title Implement Menus AP-1335 Implement Menus Jan 30, 2020
@justinanastos justinanastos marked this pull request as ready for review January 30, 2020 14:39
@justinanastos justinanastos force-pushed the justin/AP-1335/menus branch 4 times, most recently from 35417c9 to 99dde4e Compare January 31, 2020 20:36
Copy link
Member

@cheapsteak cheapsteak left a comment

Choose a reason for hiding this comment

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

Looks great!

I think this should integrate pretty well with downshift? Keyboard navigation would be great for a11y and convenience (especially for search), but makes sense to do that in the consuming package (engine-frontend) rather than the component lib

@justinanastos
Copy link
Contributor Author

Great observation @cheapsteak ; it'll totally work with downshift!

@justinanastos justinanastos added the minor Increment the minor version when merged label Feb 4, 2020
@justinanastos justinanastos merged commit 4c594c4 into master Feb 4, 2020
@justinanastos justinanastos deleted the justin/AP-1335/menus branch February 4, 2020 16:33
@apollo-bot2
Copy link
Collaborator

🚀 PR was released in v2.25.0 🚀

@apollo-bot2 apollo-bot2 added the released This issue/pull request has been released. label Feb 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants