-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[K7] Add KeyPadMenu, Popover, and Header components. #13087
Conversation
- 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.
22d0cdb
to
a05f120
Compare
@@ -25,6 +25,7 @@ time, mark, audio, video { | |||
border: 0; | |||
font-size: 100%; | |||
font: inherit; | |||
font-family: $kuiFontFamily; |
There was a problem hiding this comment.
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.
There was a problem hiding this 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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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}); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use important.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
@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. |
There was a problem hiding this 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.
9497532
to
4e80d6f
Compare
- Create kuiLink mixin.
4e80d6f
to
d6710ff
Compare
* 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.
* 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.
* 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.
@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.