[Emotion] Convert EuiFacetButton and EuiFacetGroup#5878
[Emotion] Convert EuiFacetButton and EuiFacetGroup#5878elizabetdev merged 49 commits intoelastic:mainfrom
EuiFacetButton and EuiFacetGroup#5878Conversation
|
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.
In use in Kibana.
|
|
||
| <span | ||
| css={cssTextStyles} | ||
| className="euiFacetButton__text" |
There was a problem hiding this comment.
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/ |
cchaos
left a comment
There was a problem hiding this comment.
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/ |
cchaos
left a comment
There was a problem hiding this comment.
LGTM, I just had a few last nits. But overall I think it's good to go.
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
|
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
EuiFacetButtonandEuiFacetGroupto Emotion. The horizontalEuiFacetGroupis no longer using negative margins. It was converted to useflexandgap.Facet in Emotion
With the use of
gapthe 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
EuiButtonDisplayin favor of a newEuiButtonDisplayThe EuiFacetButton is a button so it makes sense to use the
EuiButtonDisplayinstead of a custom button with some CSS styles. But to use theEuiButtonDisplayI found some issues:baseClassName.${baseClassName}${colorToClassNameMap.primary}.childrenwas 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 achildrenis not a string we assume is nottextand 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).omittedbecause 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.EuiButtonPropstypes were copied to this new file and renamed asEuiButtonDisplayProps. I believe this component should have the common button props.Deprecated
EuiButtonContentin favour ofEuiButtonDisplayContentThe 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
innerNodethat is a EuiButtonContent.EuiFacetButton is now using the new EuiButtonDisplay
With the new
EuiButtonDisplaythe goal is for all EUI button components to use theEuiButtonDisplayas a building block. So the newEuiFacetButtonis now using this component.EuiLoadingSpinner accepts new
colorpropIt's now possible to configure the EuiLoadingSpinner color. The new EuiButtonDisplayContent uses a EuiLoadingSpinner with this new
colorprop.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-inlineand-block(Logical properties)[ ] Reduce specificity where possible (usually by reducing class name chaining)gapproperty to add margin between items if using flex[ ] Can any still existing.jsfiles be converted to TS?euiCanAnimateQA