-
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
[Emotion] Convert EuiFacetButton
and EuiFacetGroup
#5878
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
className: classNames(icon.props.className, 'euiFacetButton__icon'), | ||
buttonIcon = cloneElementWithCss(icon, { | ||
css: cssIconStyles, | ||
className: 'euiFacetButton__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.
In use in Kibana.
<span | ||
css={cssTextStyles} | ||
className="euiFacetButton__text" |
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.
In use in Kibana.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
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.
Getting close, I didn't realize how involved this component is. But we should also make sure we're cleaning up any unused exports or unnecessary mixins. I'll leave the deprecation naming question to the engineers.
src/components/button/button_display/_button_display_content.styles.ts
Outdated
Show resolved
Hide resolved
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
@cchaos I went through your review:
@thompsongl I renamed both deprecated components to I updated the PR description to add the new changes. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
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.
LGTM, I just had a few last nits. But overall I think it's good to go.
Co-authored-by: Caroline Horn <[email protected]>
Co-authored-by: Caroline Horn <[email protected]>
Co-authored-by: Caroline Horn <[email protected]>
Co-authored-by: Caroline Horn <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
This reverts commit 2e836f6 to help release a patch release.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5878/ |
Summary
Converted both
EuiFacetButton
andEuiFacetGroup
to Emotion. The horizontalEuiFacetGroup
is no longer using negative margins. It was converted to useflex
andgap
.Facet in Emotion
With the use of
gap
the sizes of the components changes a little. Because we no longer have the margin top and bottom for each button.Facet layout example
I deleted one of the examples in Facet Layout section. It was repeated:
Deprecated
EuiButtonDisplay
in favor of a newEuiButtonDisplay
The EuiFacetButton is a button so it makes sense to use the
EuiButtonDisplay
instead of a custom button with some CSS styles. But to use theEuiButtonDisplay
I found some issues:baseClassName
.${baseClassName}${colorToClassNameMap.primary}
.children
was being wrapped with a span and expected to receive text.So I decided to set this component to be deprecated. To do this I renamed the component to
EuiButtonDisplayDeprecated
.The new component is meant to internal use only and for now it lives in
src/components/button/button_display/_button_display.tsx
:children
. If achildren
is not a string we assume is nottext
and the content is not wrapped in a span. This way it's easier to account for button components that don't follow the normal button structure (1 icon and text).omitted
because the old logic to apply colors to button components has to be rethought. Buttons that don't have a background color should also use this component. This logic should be thought of when we start converting other buttons that require backgrounds.EuiButtonProps
types were copied to this new file and renamed asEuiButtonDisplayProps
. I believe this component should have the common button props.Deprecated
EuiButtonContent
in favour ofEuiButtonDisplayContent
The idea of this component is to replace the
EuiButtonContent
. I called it EuiButtonDisplayContent because the way I see it in the future is this component to be an inner component of the EuiButtonDisplay. So we would always use the EuiButtonDisplay.For example, the EuiButtonEmpty uses the EuiButtonContent but in the future, it could use the EuiButtonDisplay.
eui/src/components/button/button_empty/button_empty.tsx
Lines 197 to 208 in 776e95a
As we can see the EuiButtonEmpty could use the EuiButtonDisplay. No need to create a custom button and pass the the
innerNode
that is a EuiButtonContent.EuiFacetButton is now using the new EuiButtonDisplay
With the new
EuiButtonDisplay
the goal is for all EUI button components to use theEuiButtonDisplay
as a building block. So the newEuiFacetButton
is now using this component.EuiLoadingSpinner accepts new
color
propIt's now possible to configure the EuiLoadingSpinner color. The new EuiButtonDisplayContent uses a EuiLoadingSpinner with this new
color
prop.Checklist
[ ] Checked in mobile[ ] Added documentation[ ] Checked Code Sandbox works for any docs examples[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes[ ] Updated the Figma library counterpartThings to look out for when moving styles
[ ] Anything in the backlog that could be a quick fix for that component?[ ] Convert component-specific Sass vars to exported JS versions-inline
and-block
(Logical properties)[ ] Reduce specificity where possible (usually by reducing class name chaining)gap
property to add margin between items if using flex[ ] Can any still existing.js
files be converted to TS?euiCanAnimate
QA