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

[EuiContextMenu] Add size prop #4409

Merged
merged 23 commits into from
Jan 14, 2021
Merged

Conversation

andreadelrio
Copy link
Contributor

@andreadelrio andreadelrio commented Jan 4, 2021

Summary

  • Added the prop size to EuiContextMenu to support a small size.

Frame 4

  • Added snippets to all the examples in this page
  • Slightly modified the text on the EuiContextMenuPanel section for more clarity.

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs
  • Added documentation
    - [ ] Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
    - [ ] Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@snide
Copy link
Contributor

snide commented Jan 4, 2021

Thanks, good pickup! This one always felt too airy to me. Should we possibly make this the default size (since it just affects padding)? cc @cchaos

@cchaos
Copy link
Contributor

cchaos commented Jan 4, 2021

🎉 Thanks @andreadelrio for getting this one started! I think we can take it even further than just adjusting the padding.

They way I think about our components is how they're going to be used and common scenarios. For instance, with context menus, there are 3 main usages

  1. Top (application) menu item, like Share and Export. These benefit from being the spacious medium size as each item will perform a "major" action.
  2. Repeatable action menu like in tables showing options per item. These benefit from the more compact version because they affect only a single item and are repeated per row.
  3. Toolbar actions like in the Data Grid's column sort. These benefit from an even more compact version because they most likely have a lot of options.

For now, we'll concentrate on the first 2 options. So to address the "default" comment, I think it's important to not assume intent and err on keeping the current display as default. We can adjust component level implementations, like the EuiBasicTableActions component to use the small size, but I don't think we should change the default for all usages.


As for the current design, I think the small version could also benefit from a decrease in font size. It's still using the base 16px font size which is quite large for usages like bullet 2. Also decreasing the font-size but keeping this new padding size will give the options a little more separation which I think they need.

Here's a re-paste of the original idea/screenshot:

image


Also based on the descriptions above, it would be great to include some "guidelines" about when it's best to use which size in the documentation.

@andreadelrio
Copy link
Contributor Author

@cchaos thanks for the feedback. I adjusted the font size and added some guidelines to the docs.

@andreadelrio andreadelrio requested a review from cchaos January 5, 2021 17:08
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes. The screenshots you pasted of the default theme look great, but I think there's still some work to do for the Amsterdam theme.

image

The spacing doesn't actually seem as tightened up as it could be, my suggestion would be to reduce just the top/bottom padding a bit like:

Screen Shot 2021-01-05 at 16 11 19 PM

Also, the font size of the title is now too small. It should really stay at 14px aka $euiFontSizeS and then match the same padding as mentioned above:

Screen Shot 2021-01-05 at 16 13 00 PM

CHANGELOG.md Outdated Show resolved Hide resolved
src-docs/src/views/context_menu/context_menu_example.js Outdated Show resolved Hide resolved
src-docs/src/views/context_menu/small.js Outdated Show resolved Hide resolved
src/components/context_menu/context_menu.tsx Outdated Show resolved Hide resolved
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@andreadelrio andreadelrio requested a review from cchaos January 6, 2021 21:59
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

cchaos and others added 4 commits January 11, 2021 15:26
- Swapped actual examples between Sizes and Single panel
- Added some more to a few snippets
- Also updated the euiPopoverTitle mixin to accept a size prop and re-created it for Amsterdam for better adjustments.
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@thompsongl
Copy link
Contributor

PR4U: andreadelrio#14

Prevents passing undefined size through to menu items
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

👍 LGTM! But Jenkins is failing because of an accessibility issue:

12:19:19 [duplicate-id]: Ensures every id attribute value is unique
12:19:19   Help: https://dequeuniversity.com/rules/axe/3.5/duplicate-id?application=axe-puppeteer
12:19:19   Elements:
12:19:19     - #context-menu > div:nth-child(2) > .euiPopover--anchorDownLeft.euiPopover
12:29:19 1 accessibility errors

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@andreadelrio
Copy link
Contributor Author

Jenkins, test this

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

🎉

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Just the type changes, otherwise LGTM!

src/components/context_menu/context_menu.tsx Outdated Show resolved Hide resolved
/**
* Alters the size of the items and the title
*/
size?: typeof SIZES[number];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
size?: typeof SIZES[number];
size?: keyof typeof sizeToClassNameMap;

/**
* Reduce the size to `s` when in need of a more compressed menu
*/
size?: typeof SIZES[number];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
size?: typeof SIZES[number];
size?: keyof typeof sizeToClassNameMap;

/**
* Alters the size of the items and the title
*/
size?: typeof SIZES[number];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
size?: typeof SIZES[number];
size?: keyof typeof titleSizeToClassNameMap;

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4409/

@andreadelrio andreadelrio merged commit d16d296 into elastic:master Jan 14, 2021
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.

5 participants