-
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
[UI Framework] [K7]: Buttons and loader components #13269
Conversation
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.
Looks fantastic! Just had a few suggestions.
@@ -0,0 +1,4 @@ | |||
@import 'loading'; | |||
@import 'loading_chart'; | |||
@import 'loading_message'; |
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 can remove this right?
@@ -0,0 +1,82 @@ | |||
.kuiLoading { |
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.
I think the physics of the shadow are slightly off... as the K nears its apex, more light should hit the ground below it, causing the shadow to shrink, fade, and blur:
What do you think? Here are the styles I used to get this effect:
.kuiLoading {
position: relative;
display: inline-block;
&:before,
&:after {
position: absolute;
content: "";
width: 90%;
left: 50%;
transform: translateX(-50%);
border-radius: 50%;
opacity: 0.2;
transform-origin: -50% -50%;
z-index: 1;
}
&:before {
box-shadow: 0 0 8px $kuiColorFullShade;
animation: 1s kuiLoadingPulsateAndFade $kuiAnimSlightResistance infinite;
}
&:after {
background-color: $kuiColorFullShade;
animation: 1s kuiLoadingPulsate $kuiAnimSlightResistance infinite;
}
}
.kuiLoading--medium {
&:before,
&:after {
height: $kuiSizeXS * $kuiLoadingKibanaShadowScale;
bottom: -$kuiSizeXS;
}
.kuiLoading__icon {
z-index: 999;
animation: 1s kuiLoadingBounceMedium $kuiAnimSlightResistance infinite;
}
}
.kuiLoading--large {
&:before,
&:after {
height: $kuiSizeS * $kuiLoadingKibanaShadowScale;
bottom: -$kuiSizeS;
}
.kuiLoading__icon {
animation: 1s kuiLoadingBounceLarge $kuiAnimSlightResistance infinite;
}
}
.kuiLoading--xLarge {
&:before,
&:after {
height: ($kuiSize - $kuiSizeXS) * $kuiLoadingKibanaShadowScale;
bottom: -($kuiSize - $kuiSizeXS);
}
.kuiLoading__icon {
animation: 1s kuiLoadingBounceXLarge $kuiAnimSlightResistance infinite;
}
}
@keyframes kuiLoadingBounceMedium {
50% {
transform: translateY(-$kuiSizeS);
}
}
@keyframes kuiLoadingBounceLarge {
50% {
transform: translateY(-($kuiSize - $kuiSizeXS));
}
}
@keyframes kuiLoadingBounceXLarge {
50% {
transform: translateY(-$kuiSize);
}
}
@keyframes kuiLoadingPulsateAndFade {
0% {
opacity: 0;
}
50% {
transform: scale(0.5);
opacity: 0.1;
}
100% {
opacity: 0;
}
}
@keyframes kuiLoadingPulsate {
0% {
opacity: 0.15;
}
50% {
transform: scale(0.5);
opacity: 0.05;
}
100% {
opacity: 0.15;
}
}
_index.scss
:
$kuiLoadingKibanaShadowScale: 0.75;
@import 'loading';
@import 'loading_chart';
@import 'loading_spinner';
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.
Awesome improvement.
@@ -0,0 +1,4 @@ | |||
@import 'loading'; |
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.
Would you mind renaming this to loading_kibana
?
} | ||
} | ||
|
||
.kuiButton__inner--reverse { |
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.
I think this modifier should be on the root component, to be consistent with how other modifiers work:
.kuiButton--reverse {
.kuiButton__inner {
// styles
}
}
@@ -0,0 +1,123 @@ | |||
// Our base button | |||
.kuiButton { |
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.
Can we order the classes like this (per the guidelines):
.kuiButton {
}
// Children, unnested and indented once.
.kuiButton__icon {
}
// Modifiers.
.kuiButton--fill {
.kuiButton__icon {
}
}
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.
Went with nesting here as we discussed.
|
||
|
||
|
||
|
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.
Is there a setting you can apply to your editor to ensure only a single empty line at the end of the file?
background-color: transparentize($kuiColorPrimary, .9); | ||
} | ||
|
||
&: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.
I think the transition into and out of this focus state is cool and clearly communicates focus, but it gets weird when you click the button. It feels really uncomfortable to me because I've just pushed the button and it reacts to the push, but then looks like it got stuck. We don't need to address this in this PR, but I think later on we might need to look at an alternative to get around this behavior.
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.
I agree. I don't like it either. I'll work on something better in a different PR.
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.
This is better, but now when you click the button, the "reaction" is delayed until the mouseup event. This means if your click is a little bit slower, the reaction feels out of sync with your action.
I tried playing with different pseudoselectors (:active
, :focus:not(:active)
), but couldn't find a good solution. Personally, I think maybe we could do something different to draw the eye to a focused button, e.g. a pulse effect (not looping, just a single pulse).
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.
Yeah. It's something we can do in another PR. I agree there's something cooler we can do.
} | ||
} | ||
|
||
.kuiButton__inner { |
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.
Should we call this .kuiButton__content
? Based on your suggestion in the Table PR: #13249 (comment)
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.
Yes! I brought this over, but this makes sense.
@cjcenizal OK. Adjusted as requested. Rather than use that shadow size var, I just went ahead and used some |
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.
Nice! Just a couple suggestions.
tasks/ui_framework.js
Outdated
@@ -44,6 +45,11 @@ module.exports = function (grunt) { | |||
Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done); | |||
}); | |||
|
|||
grunt.registerTask('uiFramework:compileCss', function () { |
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.
Hmmm... maybe try rebasing again? Something went wrong to cause this file to show up in the diff. I can also help you clean up the commit history if you want to pair.
const innerClasses = classNames( | ||
'kuiButton__inner', | ||
iconReverse === true ? 'kuiButton__inner--reverse' : '', | ||
iconReverse === true ? 'kuiButton--reverse' : '' |
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 should be:
const classes = classNames(
'kuiButton',
typeToClassNameMap[type],
sizeToClassNameMap[size],
className,
{
'kuiButton--fill': fill,
'kuiButton--reverse': iconReverse,
},
);
K7 buttons and loaders components.
K7 buttons and loaders components.
K7 buttons and loaders components.
Still working through this one.