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

[UI Framework] [K7]: Buttons and loader components #13269

Merged
merged 13 commits into from
Aug 2, 2017

Conversation

snide
Copy link
Contributor

@snide snide commented Aug 1, 2017

Still working through this one.

@snide snide added the Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. label Aug 1, 2017
@cjcenizal cjcenizal changed the title [WIP] [K7]: Buttons and loader components [UI Framework] [K7]: Buttons and loader components Aug 1, 2017
@cjcenizal cjcenizal self-requested a review August 1, 2017 21:34
Copy link
Contributor

@cjcenizal cjcenizal left a 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';
Copy link
Contributor

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 {
Copy link
Contributor

@cjcenizal cjcenizal Aug 1, 2017

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:

loading_kibana

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';

Copy link
Contributor Author

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';
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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 {
  }
}

Copy link
Contributor Author

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.





Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved this by using an animation instead. Now it will pop back. Might still add an outline to it as well, but should be decent for now.

Copy link
Contributor

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).

Copy link
Contributor Author

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 {
Copy link
Contributor

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)

Copy link
Contributor Author

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.

@snide
Copy link
Contributor Author

snide commented Aug 2, 2017

@cjcenizal OK. Adjusted as requested. Rather than use that shadow size var, I just went ahead and used some $size -1 stuff where it was needed. It really should be extremely rare we do that kind of thing, and likely only in animations or things that require precision movement. I figure it's a decent tradeoff with readability. When we do that kind of thing (do pixel math) I'd like to enforce that it always needs to be commented. Even if it's just to say... "requires pixel math", so we know it's not someone cheating.

Copy link
Contributor

@cjcenizal cjcenizal left a 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.

@@ -44,6 +45,11 @@ module.exports = function (grunt) {
Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done);
});

grunt.registerTask('uiFramework:compileCss', function () {
Copy link
Contributor

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' : ''
Copy link
Contributor

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,
      },
    );

@cjcenizal cjcenizal mentioned this pull request Aug 2, 2017
51 tasks
@snide snide merged commit 21d5074 into elastic:k7-ui-framework Aug 2, 2017
@snide snide deleted the k7/butons branch August 2, 2017 16:34
cjcenizal pushed a commit to cjcenizal/kibana that referenced this pull request Aug 16, 2017
cjcenizal pushed a commit to cjcenizal/kibana that referenced this pull request Aug 26, 2017
cjcenizal pushed a commit that referenced this pull request Sep 19, 2017
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