Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Moving EuiBreadcrumb styles to Emotion. #5934
Moving EuiBreadcrumb styles to Emotion. #5934
Changes from 3 commits
62a1154
6fd7844
668ddb5
53c6ca2
4424580
8d07aa0
4f24e55
9cc29e2
347725a
a455722
8aa914e
e50a5f9
89be267
bfb5e9b
a267e5e
63d7bdd
6051809
a686260
734690e
92d71fb
9b5687f
58ecfea
5d3de7e
0d01636
9a90af4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
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
EuiHeaderBreadcrumbs
didn't have an easy way to cast styles into child elements, so I added aheaderBreadcrumb
boolean prop so we could target header breadcrumbs.I don't think this will be a breaking change because I passed the
headerBreadcrumb
prop into theEUIHeaderBreadcrumbs
component, so it'll get picked up automatically and cast the new styles. If the reviewers feel this will be a breaking change, I'm happy to refactor.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.
Not a breaking change! I ended up following this pattern and adding another
isNested
prop (used for breadcrumbs within the collapsed popover - e50a5f9). It's much cleaner to handle this logic via JS rather than nested CSS.I'm not 100% on this but I'm not a super huge fan of the
headerBreadcrumb
/isHeaderBreadcrumb
var name. It feels super duper specific when there's arguably a use case for the visual style outside ofEuiHeader
. I'm wondering if a prop name likeisBadge
orisChevron
would be more descriptive. @1Copenut @miukimiu any thoughts here?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'm on board for a more descriptive prop name. I used
isHeaderBreadcrumb
purely because it fit with the presentation naming / spaces in EUI. I agree that it could be improved on if these styles can exist outsideEuiHeader
. Great call!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 now a boolean flag, so super easy to see the visual effect on the playground!
It's just kind of a question of intention in visual language, I suppose. If we're OK with the chevron effect being used in places other than EuiHeader, then it makes sense to name it more generically. If it's only supposed to be used by EuiHeader, then it makes sense to be more specific and document it as such. I don't know for sure though, hence why I'm tagging in our designers.
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 an excellent way to visualize and document the conditional styling.
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 EuiHeaderBreadcrumb was added by @cchaos and because she didn't add the styles directly in EuiBreadcrumb I'm assuming she intentionally only wanted those styles to appear for EuiHeader.
But that's my assumption... Caroline is back on Monday so I guess we can wait and she let us know. 😄
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.
Right, agreed. I want to note that we could move the styles to
src/components/header/header_breadcrumbs
instead of remaining insrc/components/breadcrumb
, but there are a few (minor) disadvantages to doing so vs keeping all the styles inbreadcrumb.styles.ts
:Which, if consumers wanted to override those overrides, they would have to do so either via
!important
or their own nested selector. Not a huge deal, but IIRC we were trying to flatten nested selectors as part of the Emotion conversion.EuiBreadcrumb
was messing with that or causing unexpected effects, it might not be 100% clear where the parent breadcrumb styles live or are coming from (vs being able to skim all styles at once in one file). Again, not a huge or impossible ordeal to surmount.We can definitely wait for Caroline to get back for clarity. In the interim I pushed up 6051809 to hide the new internal props from the props table, and renamed them more specifically/added comments as to their internal nature
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 way I look at it is that no matter how we obfuscate the new prop, consumers can still use EuiHeaderBreadcrumbs anywhere they want. In this PR, the only header-specific styles applied to EuiBreadcrumbs is to enforce truncation and spacing when within the context of EuiHeader. If a consumer wants the look of EuiHeaderBreadcrumbs outside of EuiHeader, they'll most likely be fighting with these extra styles.
Therefore, I suggest keeping this new prop visible to all consumers so they can attain this look anywhere. But I think the name
isInEuiHeader
is a bit awkward and a pattern we haven't established. I would consider naming it something that points to the purpose of the style and make it an enum, maybe something liketype: 'page' | 'application'
. And commenting that there should really only be onapplication
style breadcrumb per view.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.
Sorry, yes,
isInEuiHeader
is overly explicit/awkward and is only what I would have named it if we weren't going to publicly expose the prop. I like thetype
prop instead for helping designate the purpose!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.
a686260 & 734690e - both new props should now be documented and testable in the playground.
@cchaos @miukimiu, do either of you want to do a pass on this before merging? From an engineering review POV, this is good to go.