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

[K7] Add KeyPadMenu, Popover, and Header components. #13087

Merged

Conversation

cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Jul 25, 2017

@snide I haven't Reactified the newer components you added, like the user popover or the link. Note that I made some changes to the reset and had to drop usage of our namespacing mixins in a couple places because they couldn't support my use case.

@cjcenizal cjcenizal added the Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. label Jul 25, 2017
- Rename KeyPad to KeyPadMenu and PopMenu to Popover.
- Tweak reset to be less opinionated about link styles, and more opinionated about global font-family.
- HeaderLogo.
- HeaderSection, HeaderSectionItem, HeaderSectionItemButton.
- HeaderBreadcrumbs, HeaderBreadcrumb, HeaderBreadcrumbCollapsed.
@cjcenizal cjcenizal force-pushed the k7/reactify-header-components branch from 22d0cdb to a05f120 Compare July 25, 2017 17:27
@cjcenizal cjcenizal changed the title [K7] Add KeyPadMenu and Popover components. [K7] Add KeyPadMenu Popover, and Header components. Jul 25, 2017
@cjcenizal cjcenizal requested a review from snide July 25, 2017 17:27
@@ -25,6 +25,7 @@ time, mark, audio, video {
border: 0;
font-size: 100%;
font: inherit;
font-family: $kuiFontFamily;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This overrides the default font-family Chrome applies to the button element via the font property.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Did a quick pass.

const classes = classNames(
'kuiPopover',
anchorPositionToClassNameMap[anchorPosition],
isOpen ? 'isOpen' : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

For the popover component I would simply not render the popover body until it's clicked. There's no reason to keep it around in the dom when the page loads.

I'd remove the isOpen state and just apply the animation as a transition delay.

Copy link
Contributor

Choose a reason for hiding this comment

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

Once opened it should be dismissible by clicking outside the popover itself.

Copy link
Contributor Author

@cjcenizal cjcenizal Jul 25, 2017

Choose a reason for hiding this comment

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

apply the animation as a transition delay.

What do you mean by this? Can you give an example?

border-color: transparent;
border-radius: $kuiBorderRadius;

&:hover, &:focus {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hover state and focus state are different. You converged them.

@@ -1,7 +1,8 @@
// Pop menu is an animated popover relatively positioned to a button / action.
// By default it positions in the middle, but can be anchored left and right.

@include component('kuiPopMenu') {
@include component('kuiPopover') {
Copy link
Contributor

Choose a reason for hiding this comment

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

The changes with how you're doing positioning here break the usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem we need to solve is that the original way the Popover was implemented caused the arrow to overlap the content, which works great for the Header, but not so great for anything else. You can see this on the Popover example page:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed on slack. Modifier for less common case (the header) to make it flush.

@@ -19,18 +20,22 @@
background: $kuiColorEmptyShade;
position: absolute;
min-width: $kuiSize * 16; // Can expand further, but this size is good for our menus.
top: 100%;
left: -$kuiSize * 8;
top: calc(100% + #{$kuiSizeS});
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid calcs if you can. They are pretty dirty and hard to read.

}

&:focus {
text-decoration: underline;
background: $kuiFocusBackgroundColor;
text-decoration: none;
Copy link
Contributor

@snide snide Jul 25, 2017

Choose a reason for hiding this comment

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

These changes broke the focus state of a bunch of stuff (see breadcrumbs). These should be left in because they are a completely common pattern and I'd rather not have to write focus states and hover states for everything.

Copy link
Contributor Author

@cjcenizal cjcenizal Jul 25, 2017

Choose a reason for hiding this comment

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

The reason I made this change was because KeyPadMenuItemButton wasn't picking up the underline on hover, since it's a <button> and not a link. This was a really subtle difference and I can see it being very easily overlooked by someone working on the UI Framework. Imagine we change the link behavior sometime in the future -- how will we know which components need to be updated to share this behavior?

What we really need is a single source of truth for link-like behavior, which can be consumed by all the components which need it, and which will be the one place we need to update when we want to change this behavior.

I think we should create a mixin to encapsulate this behavior and solve this problem. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a valid point, but man that mixin is going to be everywhere.

I'm not too opinionated, but if you go the mixin route make sure to add it back to the breadcrumbs.

vertical-align: middle;

@include child('icon') {
height: $kuiSizeXL !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use important.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need it to override .kuiIcon--medium.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need kui--medium on the icon here? All it provides is size. This should be used instead of it, not on top of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the default for when no size is specified. To remove the !important, we have to remove the default size, which is fine with me.

@@ -10,7 +11,7 @@
opacity: 1;
visibility: visible;
z-index: 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

This was a mistake of mine. You should use a variable for this... $kuiZContent

- Fix hover and focus states for KeyPadMenuItem.
- Remove default size on Icon.
@cjcenizal
Copy link
Contributor Author

@snide I addressed your feedback. I'm leaving the link mixin stuff for later, for when we create a Link React component and example page for it.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Asked CJ to fix the focus states. Then we're all good.

@cjcenizal cjcenizal force-pushed the k7/reactify-header-components branch from 9497532 to 4e80d6f Compare July 25, 2017 21:29
@cjcenizal cjcenizal force-pushed the k7/reactify-header-components branch from 4e80d6f to d6710ff Compare July 25, 2017 21:29
@cjcenizal cjcenizal changed the title [K7] Add KeyPadMenu Popover, and Header components. [K7] Add KeyPadMenu, Popover, and Header components. Jul 25, 2017
@cjcenizal cjcenizal merged commit 9e6fcfd into elastic:k7-ui-framework Jul 25, 2017
@cjcenizal cjcenizal deleted the k7/reactify-header-components branch July 25, 2017 21:33
@cjcenizal cjcenizal mentioned this pull request Jul 25, 2017
51 tasks
cjcenizal added a commit to cjcenizal/kibana that referenced this pull request Aug 16, 2017
* Add Popover component.
* Rename KeyPad to KeyPadMenu and PopMenu to Popover.
* Add KeyPadMenu component.
* Tweak reset to be less opinionated about link styles, and more opinionated about global font-family.
  - Create kuiLink mixin.
* Add Header components.
  - HeaderLogo.
  - HeaderSection, HeaderSectionItem, HeaderSectionItemButton.
  - HeaderBreadcrumbs, HeaderBreadcrumb, HeaderBreadcrumbCollapsed.
* Remove default size on Icon.
* Fix linting errors.
cjcenizal added a commit to cjcenizal/kibana that referenced this pull request Aug 26, 2017
* Add Popover component.
* Rename KeyPad to KeyPadMenu and PopMenu to Popover.
* Add KeyPadMenu component.
* Tweak reset to be less opinionated about link styles, and more opinionated about global font-family.
  - Create kuiLink mixin.
* Add Header components.
  - HeaderLogo.
  - HeaderSection, HeaderSectionItem, HeaderSectionItemButton.
  - HeaderBreadcrumbs, HeaderBreadcrumb, HeaderBreadcrumbCollapsed.
* Remove default size on Icon.
* Fix linting errors.
cjcenizal added a commit that referenced this pull request Sep 19, 2017
* Add Popover component.
* Rename KeyPad to KeyPadMenu and PopMenu to Popover.
* Add KeyPadMenu component.
* Tweak reset to be less opinionated about link styles, and more opinionated about global font-family.
  - Create kuiLink mixin.
* Add Header components.
  - HeaderLogo.
  - HeaderSection, HeaderSectionItem, HeaderSectionItemButton.
  - HeaderBreadcrumbs, HeaderBreadcrumb, HeaderBreadcrumbCollapsed.
* Remove default size on Icon.
* Fix linting errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants