Add isLoading and isLoadingMessage props to EuiAccordion#3879
Add isLoading and isLoadingMessage props to EuiAccordion#3879andreadelrio merged 11 commits intoelastic:masterfrom
Conversation
b3ca120 to
05c49a7
Compare
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
elizabetdev
left a comment
There was a problem hiding this comment.
Hi @andreadelrio! Thanks for adding these props ! 🎉
I found a few issues. I think the loading could be vertical centered:
Also, should we have a default isLoadingMessage? Or we could end up having cases like the following one:
Also when I added the isLoading and isLoadingMessage to the first example the isLoadingMessage gets a little bit cut:
|
@miukimiu thanks for the review! I added a default message, fixed styling and also fixed an issue where |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
1 similar comment
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
b19996f to
654aa1b
Compare
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
elizabetdev
left a comment
There was a problem hiding this comment.
Thanks for making changes. Tested again and LGTM! 🎉
I just noticed the build is failing when running the a11y-testing.
cchaos
left a comment
There was a problem hiding this comment.
I'd have one suggestion to ask for. In Lens, we use accordions and also currently fake the loading state similar to what you're doing with the extraAction piece. However, these loading moments don't necessarily mean that everything inside the accordion is going to change. In fact, we want to be sure that they can still interact with the original content while more content is being loaded.
My ask is if you can make having the loading message replace the content entirely as optional. The way I would do that is by allowing the isLoadingMessage prop to also accept a boolean, and I'd even go further to suggest defaulting to false (off) just because I'm not sure that it's going to be the most common need. I left some code comments on how you could approach it.
| buttonContent="Click to open" | ||
| extraAction={<EuiButton size="s">Extra action!</EuiButton>} | ||
| isLoading | ||
| isLoadingMessage="Loading, please wait"> |
There was a problem hiding this comment.
By adding this custom message it looks to the user that it may be the default. I'd suggest keeping only the default in the example or add a toggle that will showcase what the default vs a custom message may look like.
@cchaos Thanks for the suggestion and for providing insight into a real use case. Here's where I took the example: |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
cchaos
left a comment
There was a problem hiding this comment.
Sweet, thanks! Just some nits now
CHANGELOG.md
Outdated
| ## [`master`](https://github.com/elastic/eui/tree/master) | ||
|
|
||
| No public interface changes since `28.0.0`. | ||
| - Add `isLoading` and `isLoadingMessage` props to `EuiAccordion` ([#3879](https://github.com/elastic/eui/pull/3879)) |
There was a problem hiding this comment.
| - Add `isLoading` and `isLoadingMessage` props to `EuiAccordion` ([#3879](https://github.com/elastic/eui/pull/3879)) | |
| - Added `isLoading` and `isLoadingMessage` props to `EuiAccordion` ([#3879](https://github.com/elastic/eui/pull/3879)) |
| <EuiFlexGroup alignItems="center"> | ||
| <EuiFlexItem grow={false}> | ||
| <EuiTitle size="xs"> | ||
| <h2>isLoadingMessage: </h2> |
There was a problem hiding this comment.
| <h2>isLoadingMessage: </h2> | |
| <h3>isLoadingMessage: </h3> |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/ |
cchaos
left a comment
There was a problem hiding this comment.
👍 Looks Great! Thanks for making it more flexible.
| isLoading | ||
| isLoadingMessage={customMessage} | ||
| > | ||
| <!-- Content that will be replaced by isLoadingMessage --> |




Summary
Setting
isLoadingto true, adds aEuiLoadingSpinnerto the accordion's triggerWrapper. The content is also replaced with aEuiLoadingSpinnerwhich can take a custom loading message viaisLoadingMessage.Fixes #3773
Checklist
- [ ] Checked Code Sandbox works for the any docs examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes