-
Notifications
You must be signed in to change notification settings - Fork 841
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
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: |
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment in here why you're altering a different component
...rest | ||
}) => { | ||
const classes = classNames('euiFlyoutBody', className); | ||
const overflowClasses = classNames('euiFlyoutBody__overflow', { | ||
'euiFlyoutBody__overflow-banner': banner, |
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.
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}'"; |
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! 🎉
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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 |
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! 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): ![timeline-padding-before-chrome](https://user-images.githubusercontent.com/4459398/76060425-81e37500-5f3e-11ea-8083-a58297afee85.png) ### After Chrome `80.0.3987.132` The new code in this PR uses `euiFlyoutBody__overflowContent`, which restores the Timeline's original padding: ![timeline-paddng-after-chrome-default-theme](https://user-images.githubusercontent.com/4459398/76060436-8b6cdd00-5f3e-11ea-80d6-9ff0e74722c3.png) ![timeline-padding-after-chrome-dark-theme](https://user-images.githubusercontent.com/4459398/76060601-dedf2b00-5f3e-11ea-8a46-1008d7defe09.png) ### After Firefox `73.0.1` ![timeline-padding-after-firefox](https://user-images.githubusercontent.com/4459398/76060692-18b03180-5f3f-11ea-8277-31b6f9dbf211.png) ### After Safari `13.0.5` ![timeline-padding-after-safari](https://user-images.githubusercontent.com/4459398/76060744-38475a00-5f3f-11ea-9b04-cdd45fa41702.png)
## [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): ![timeline-padding-before-chrome](https://user-images.githubusercontent.com/4459398/76060425-81e37500-5f3e-11ea-8083-a58297afee85.png) ### After Chrome `80.0.3987.132` The new code in this PR uses `euiFlyoutBody__overflowContent`, which restores the Timeline's original padding: ![timeline-paddng-after-chrome-default-theme](https://user-images.githubusercontent.com/4459398/76060436-8b6cdd00-5f3e-11ea-80d6-9ff0e74722c3.png) ![timeline-padding-after-chrome-dark-theme](https://user-images.githubusercontent.com/4459398/76060601-dedf2b00-5f3e-11ea-8a46-1008d7defe09.png) ### After Firefox `73.0.1` ![timeline-padding-after-firefox](https://user-images.githubusercontent.com/4459398/76060692-18b03180-5f3f-11ea-8277-31b6f9dbf211.png) ### After Safari `13.0.5` ![timeline-padding-after-safari](https://user-images.githubusercontent.com/4459398/76060744-38475a00-5f3f-11ea-9b04-cdd45fa41702.png)
…#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): ![timeline-padding-before-chrome](https://user-images.githubusercontent.com/4459398/76060425-81e37500-5f3e-11ea-8083-a58297afee85.png) ### After Chrome `80.0.3987.132` The new code in this PR uses `euiFlyoutBody__overflowContent`, which restores the Timeline's original padding: ![timeline-paddng-after-chrome-default-theme](https://user-images.githubusercontent.com/4459398/76060436-8b6cdd00-5f3e-11ea-80d6-9ff0e74722c3.png) ![timeline-padding-after-chrome-dark-theme](https://user-images.githubusercontent.com/4459398/76060601-dedf2b00-5f3e-11ea-8a46-1008d7defe09.png) ### After Firefox `73.0.1` ![timeline-padding-after-firefox](https://user-images.githubusercontent.com/4459398/76060692-18b03180-5f3f-11ea-8277-31b6f9dbf211.png) ### After Safari `13.0.5` ![timeline-padding-after-safari](https://user-images.githubusercontent.com/4459398/76060744-38475a00-5f3f-11ea-9b04-cdd45fa41702.png)
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:
banner
toEuiFlyOutBody
which takes a nodeborderless
toEuiCallOut
which removes the usual border from calloutsChecklist
- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes