Skip to content

Add isLoading and isLoadingMessage props to EuiAccordion#3879

Merged
andreadelrio merged 11 commits intoelastic:masterfrom
andreadelrio:isLoading-accordion
Aug 17, 2020
Merged

Add isLoading and isLoadingMessage props to EuiAccordion#3879
andreadelrio merged 11 commits intoelastic:masterfrom
andreadelrio:isLoading-accordion

Conversation

@andreadelrio
Copy link
Copy Markdown
Contributor

Summary

Setting isLoading to true, adds a EuiLoadingSpinner to the accordion's triggerWrapper. The content is also replaced with a EuiLoadingSpinner which can take a custom loading message via isLoadingMessage.

isloading

Fixes #3773

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs
  • Added documentation
    - [ ] Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
    - [ ] Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

Copy link
Copy Markdown
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @andreadelrio! Thanks for adding these props ! 🎉

I found a few issues. I think the loading could be vertical centered:

Screenshot 2020-08-11 at 12 39 06

Also, should we have a default isLoadingMessage? Or we could end up having cases like the following one:

Screenshot 2020-08-11 at 14 51 18

Also when I added the isLoading and isLoadingMessage to the first example the isLoadingMessage gets a little bit cut:

Screenshot 2020-08-11 at 14 48 49

@andreadelrio
Copy link
Copy Markdown
Contributor Author

@miukimiu thanks for the review! I added a default message, fixed styling and also fixed an issue where isLoading wasn't working unless there was an extraAction being passed.

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

1 similar comment
@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

Copy link
Copy Markdown
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making changes. Tested again and LGTM! 🎉

I just noticed the build is failing when running the a11y-testing.

Copy link
Copy Markdown
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@andreadelrio
Copy link
Copy Markdown
Contributor Author

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.

@cchaos Thanks for the suggestion and for providing insight into a real use case. Here's where I took the example:

isL

@andreadelrio andreadelrio requested a review from cchaos August 12, 2020 21:51
@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

Copy link
Copy Markdown
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<h2>isLoadingMessage: </h2>
<h3>isLoadingMessage: </h3>

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

@andreadelrio andreadelrio requested a review from cchaos August 14, 2020 18:23
@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_3879/

Copy link
Copy Markdown
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks Great! Thanks for making it more flexible.

isLoading
isLoadingMessage={customMessage}
>
<!-- Content that will be replaced by isLoadingMessage -->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EuiAccordion - support isLoading state

4 participants