Add banner prop to EuiFlyoutBody#2837
Conversation
9378870 to
5fda399
Compare
5fda399 to
f1a10f7
Compare
|
Hmm, part of this PR worries me a bit. Having two different styles of callouts (bordered and not) will cause some major inconsistencies in our applications. Mainly I'm thinking because devs won't necessarily know which one they should choose and pick entirely on aesthetics (which really is the only reason there's a difference). Looking at the flyout version, it does look nice and I can think of several places that would benefit from this design. Which brings up another thing to consider. Should those other places get updated to reflect this new design (again for consistency)? So my main question is, does the need for the callout to extend to the sides of the flyout (which is just an aesthetic choice at the moment) outweigh the possibilities of inconsistent callout types throughout the applications? There's also another approach you could take that would ease the concern of inconsistent callouts, in which you apply a custom className to the provided If we do move forward with this, something to consider is that the overflow mask in the flyout body is causing the top portion of the callout to fade out as it approaches the header border. |
|
@cchaos Thanks for bringing up all these points. I hadn't fully considered the risk of inconsistencies in the use of callouts and I can understand the concern. To answer your question, I think the need for a "full width" callout in a flyout does not warrant the risk of inconsistent callout use. Having said that though I do think we should allow for a "full width" banner in flyouts, it just doesn't have to mean be add a borderless prop to callout. The flyout with a regular callout as banner looks like this: I don't think this looks too bad which makes me wonder if we'd need to remove the border at all. We could always leave it up to the consumer to remove the border in a callout when using it in a flyout? Is that bad practice? |
I'll agree that it doesn't look too "bad", but obviously the non-bordered looks a bit better. I'll leave it up to you to decide if you'd want to keep the border in the flyout or not. However, I'd just not add it as a direct option of EuiCallout, but a custom override with classes.
By leave it up to the consumer, do you mean letting them do the overrides or using a prop on EuiCallout? Consumers can override anything they want really, we just don't usually add docs around this specifically. However, adding this override into EUI would be as simple as:
<div className="euiFlyout__banner">{banner}</div>`.
.euiFlyout__banner .euiCallOut {
border: none;
} |
|
@cchaos Agreed about not adding borderless prop to callouts anymore. Yeah I know consumers can override anything, I guess I was wondering if it'll be weird for them to pass a "regular" callout as banner and see it doesn't have a border. But I guess that's not a big deal and I could always make a note in the docs that callouts get their border removed in flyouts.
About this, I also noticed it and wasn't sure how to handle it. Would we push the banner down a bit, or remove I like how it looks without mask-image better but don't know how strict we are when it comes to allowing for this type of modifications. Or is there another way to handle it? |
|
I would consider creating an alternate |
@cchaos My plan for this would be to modify euiOverflowShadow to also take a parameter called |
|
@cchaos I made the changes we discussed. I also updated the docs to reflect the changes on Updated flyout with banner and bottom shadows: |
cchaos
left a comment
There was a problem hiding this comment.
@andreadelrio and I talked about not needing the granularity of extra mixins and utility classes that the new params to euiOverflowShadow provides. But she'll throw a link directly to this mixin into the documentation at the very least.
| HTMLAttributes<HTMLDivElement> & | ||
| CommonProps & { | ||
| /** | ||
| * Use to display a banner at the top of the body. It is suggested to use a borderless `EuiCallOut` for it. |
There was a problem hiding this comment.
May want to adjust this comment now that there's no such thing as a borderless callout.
| } | ||
|
|
||
| .euiFlyoutBody__overflow-banner .euiCallOut { | ||
| border: none; |
There was a problem hiding this comment.
Add a comment in here why you're altering a different component
| }) => { | ||
| const classes = classNames('euiFlyoutBody', className); | ||
| const overflowClasses = classNames('euiFlyoutBody__overflow', { | ||
| 'euiFlyoutBody__overflow-banner': banner, |
There was a problem hiding this comment.
Remember that BEM naming suggests that modifiers should use a -- and you might want to say it hasBanner instead otherwise it sounds like it's trying to target the banner itself.
This class also shouldn't be the one used to target the callout or else any callouts within the rest of children will also get the border removed. So instead, your element would be:
// If banner exists (= true), then spit out the wrapper plus the banner element
{banner &&
<div class="euiFlyoutBody__banner">
{banner}
</div>
}| transparentize(red, .9) 100%; | ||
| } | ||
| } @else { | ||
| @warn "euiOverflowShadow() expects side to be 'both', 'start' or 'end' but got '#{$side}'"; |
| @if ($side == 'both' or $side == 'start' or $side == 'end') { | ||
| @if ($side == 'both') { | ||
| $gradient: transparentize(red, .9) 0%, | ||
| transparentize(red, 0) $hideHeight, | ||
| transparentize(red, 0) calc(100% - #{$hideHeight}), | ||
| transparentize(red, .9) 100%; | ||
| } @else if ($side == 'start') { | ||
| $gradient: transparentize(red, .9) 0%, | ||
| transparentize(red, 0) $hideHeight; | ||
| } @else { | ||
| $gradient: transparentize(red, 0) calc(100% - #{$hideHeight}), | ||
| transparentize(red, .9) 100%; | ||
| } |
There was a problem hiding this comment.
If you want to further reduce some repetition here. You could create two top variables of:
$gradientStart:
transparentize(red, .9) 0%,
transparentize(red, 0) $hideHeight;
$gradientEnd:
transparentize(red, 0) calc(100% - #{$hideHeight}),
transparentize(red, .9) 100%;And then use those in the if statement:
@if ($side == 'both') {
$gradient: $gradientStart, $gradientEnd;
} @else if ($side == 'start') {
$gradient: $gradientStart;
} @else {
$gradient: $gradientEnd;
}f048ae0 to
587392c
Compare
587392c to
5c1d80d
Compare
cchaos
left a comment
There was a problem hiding this comment.
All the changes look good! I would also add a new docs example for the banner prop and a use-case for it.
|
@cchaos I added the example with the banner. I also removed references to |
cchaos
left a comment
There was a problem hiding this comment.
🎉 Awesome! Thanks for also cleaning up those unused states and adding a snippet.
[A recent update to EUI](elastic/eui#2837) requires an update to Timeline to restore its original padding, per the before / after screenshots below: ### Before The previous code, which was using the `euiFlyoutBody__overflow` style, has extra padding (before this PR):  ### After Chrome `80.0.3987.132` The new code in this PR uses `euiFlyoutBody__overflowContent`, which restores the Timeline's original padding:   ### After Firefox `73.0.1`  ### After Safari `13.0.5` 
## [SIEM] Update Timeline to use the latest euiFlyoutBody style [A recent update to EUI](elastic/eui#2837) requires an update to Timeline to restore its original padding, per the before / after screenshots below: ### Before The previous code, which was using the `euiFlyoutBody__overflow` style, has extra padding (before this PR):  ### After Chrome `80.0.3987.132` The new code in this PR uses `euiFlyoutBody__overflowContent`, which restores the Timeline's original padding:   ### After Firefox `73.0.1`  ### After Safari `13.0.5` 
…#59561) ## [SIEM] Update Timeline to use the latest euiFlyoutBody style [A recent update to EUI](elastic/eui#2837) requires an update to Timeline to restore its original padding, per the before / after screenshots below: ### Before The previous code, which was using the `euiFlyoutBody__overflow` style, has extra padding (before this PR):  ### After Chrome `80.0.3987.132` The new code in this PR uses `euiFlyoutBody__overflowContent`, which restores the Timeline's original padding:   ### After Firefox `73.0.1`  ### After Safari `13.0.5` 






Summary
In order to build the drilldowns feature, we'd like have a borderless callout at the top of a flyout. For that reason this PR:
bannertoEuiFlyOutBodywhich takes a nodeborderlesstoEuiCallOutwhich removes the usual border from calloutsChecklist
- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes