EuiAccordion convert Sass to Emotion CSS#5826
EuiAccordion convert Sass to Emotion CSS#58261Copenut merged 22 commits intoelastic:mainfrom 1Copenut:feature/tpierce-eui-accordion-emotion
EuiAccordion convert Sass to Emotion CSS#5826Conversation
* Fixed the WithEuiTheme HOC export TypeScript errors. * Refactoring Emotion to exports for relevant tags. * Adding named export for child wrapper. * Moving last stateful CSS to Emotion before adding padding prop. * Adding last Emotion styles using paddingSize prop. * Small refactoring of types before updating tests. WIP. Need to add TS props for passing builds.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
1 similar comment
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
EuiAccordion convert Sass to Emotion CSSEuiAccordion convert Sass to Emotion CSS
|
I could use a hand from reviewers to determine if this is still a breaking change. My hunch is no, because the work for |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
@1Copenut I'll look into this |
@thompsongl There were two errors initially. I figured out the ID issue by adding a prop type to the accordion playground.js file: propsToUse.id = {
...propsToUse.id,
value: htmlIdGenerator('generated')(),
+ type: PropTypes.String,
};The other I have no goodly idea. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
cchaos
left a comment
There was a problem hiding this comment.
Playground
One oddness I'm trying to understand is that while in the Playground, when toggling isLoading to true, the spinner never shows up (even though it works fine in the docs). This isn't unique to this PR as it occurs in production. However, the difference I am seeing between prod and this PR is that when isLoading=true and arrowDisplay="none" I'm still seeing the arrow:
Snapshot
I feel strongly that we should fix this before we merge this PR, but the snapshots are rendering the entire JSON output of the theme.
Snippet
exports[`EuiAccordion behavior closes when clicked twice 1`] = `
<WithEuiTheme(EuiAccordionClass)
id="18"
>
<EuiAccordionClass
arrowDisplay="left"
buttonElement="button"
element="div"
id="18"
initialIsOpen={false}
isLoading={false}
isLoadingMessage={false}
paddingSize="none"
theme={
Object {
"colorMode": "LIGHT",
"euiTheme": Object {
"animation": Object {
"bounce": "cubic-bezier(.34, 1.61, .7, 1)",
"extraFast": "90ms",
"extraSlow": "500ms",
"fast": "150ms",
"normal": "250ms",
"resistance": "cubic-bezier(.694, .0482, .335, 1)",
"slow": "350ms",
},
"base": 16,
"border": Object {
"color": "#D3DAE6",
"editable": "2px dotted #D3DAE6",
"radius": Object {
"medium": "6px",
"small": "4px",
},
"thick": "2px solid #D3DAE6",
"thin": "1px solid #D3DAE6",
"width": Object {
"thick": "2px",
"thin": "1px",
},
},
Styles based on props
Lastly, we should really only be doing the prop checking in the component TSX. The styles should purely be key: css pairs where key is the value of the prop (like the paddingSize one). See this section of the wiki: https://github.com/elastic/eui/blob/main/wiki/writing-styles-with-emotion.md#component-props-that-enable-styles
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
@cchaos I confirmed the loading spinner is working on localhost playground if I toggle |
|
@1Copenut I've located the |
cchaos
left a comment
There was a problem hiding this comment.
Design code LGTM (one tiny suggestion). I double checked any effects on EuiCollapsibleNavGroup and EuiNotificationEvent as well.
Worth getting an eng to look over the class stuff.
| euiAccordion__spinner: css``, | ||
| isLoading: css` | ||
| margin-right: ${euiTheme.size.xs}; | ||
| `, |
There was a problem hiding this comment.
Nit: the spinner only shows up when isLoading is true, so there's no need for this qualifier, it can just be applied directly to the base selector.
| euiAccordion__spinner: css``, | |
| isLoading: css` | |
| margin-right: ${euiTheme.size.xs}; | |
| `, | |
| euiAccordion__spinner: css` | |
| margin-right: ${euiTheme.size.xs}; | |
| `, |
There was a problem hiding this comment.
Thanks Caroline. Change made and snapshot updated.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5826/ |
|
I'm pushing this PR off to Stack 8.4 release because I know that changes to EuiAccordion in the past have caused consumers grief. So I worry about this one so close to 8.3 FF. |
There was a problem hiding this comment.
Code changes LGTM
I'm pushing this PR off to Stack 8.4 release because I know that changes to EuiAccordion in the past have caused consumers grief. So I worry about this one so close to 8.3 FF.
Probably safe to merge this. v57 is the last one going into 8.3, and any backports won't include the changes here. But feel free to wait til next week if you want.
breehall
left a comment
There was a problem hiding this comment.
This looks good to me! Great work on this Trevor!




Summary
PR to move
EuiAccordionto Emotion CSS.This is dependent on @cchaos work on font-size and line-height. I'll add those items as they're ready.I'm opting to remove the
breaking changelabel. We've decided to hold off refactoring the accordion in form work to another PR:Checklist
Added documentationUpdated the Figma library counterpart