Skip to content
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

Add EuiEmptyPrompt. #711

Merged
merged 6 commits into from
May 1, 2018
Merged

Add EuiEmptyPrompt. #711

merged 6 commits into from
May 1, 2018

Conversation

cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Apr 28, 2018

image

Also supports less content and more actions:

image

Works well in tables:

image

@snide
Copy link
Contributor

snide commented Apr 30, 2018

@cjcenizal In a separate PR I would likely add the ability for this to be paneled (and centered) and to pass a titleSize prop. Think those additions would give us 90% empty state use cases so far in design.

@cjcenizal
Copy link
Contributor Author

@snide Just curious: what are the situations in which different title sizes will be used? If we want that kind of flexibility it might just make sense to remove the EuiTitle from the implementation and require the consumer to pass this in.

Copy link
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 agree with @snide that we will want to add paneled/paged versions to this. I foresee an situation where we'd want to change the title size depending on the surrounding layout. If the object that is empty is a minor part of the layout, this heading may be too large.

if (iconType) {
icon = (
<Fragment>
<EuiIcon type={iconType} size="xxl" color="subdued" />
Copy link
Contributor

Choose a reason for hiding this comment

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

We should allow the user to display the icon in any color.


if (Array.isArray(actions)) {
actionsRow = (
<EuiFlexGroup gutterSize="m" alignItems="center" justifyContent="center">
Copy link
Contributor

Choose a reason for hiding this comment

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

Actions within a block of centered text should be stacked with the primary action on top, not horizontal. Similar to the way cards handles this:
screen shot 2018-04-30 at 12 39 51 pm

max-width: 36em;
// If the max-width is way too short of the width of the container,
// at least make it 2/3 of it's parent
min-width: 75%;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of having this min-width on centered content as long line lengths on centered content is very hard to read and since we're centered we don't have to worry about the space we take up compared to other parts of the layout.

Instead of making this a mixin, can you just change the 36em into a variable and use that?

<Fragment>
<EuiText>
{body}
</EuiText>
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this support callouts and other types of content that isn't just plain text?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't. Should we make that a requirement?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm honestly on the fence, I feel like the flexibility would be nice, but it would be very rare cases... @snide?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's OK as is. For rare cases we can always build something unique when we need it.

@snide
Copy link
Contributor

snide commented Apr 30, 2018

@cjcenizal Think @cchaos covered it, but the two common scenarios we often design are

  • An empty state for an entire page. In these, the h2 / "m" sizing is correct. These would also be paneled.
  • An empty state for list view of content (like a table). These would likely be something like an h4 / "xs" size since we don't need to scream at them that there is no content. These are usually not paneled.

Your table example is the later, and the sizing should be smaller.

@cjcenizal
Copy link
Contributor Author

@cchaos @snide Thanks for the feedback! I've addressed everything.

image

image

The user can now set the title size and the button size, though I think the size of the icon and the vertical spacing becomes a little disproportionate as these sizes change. It might be better to provide a single "size" prop, which then scales the size of the icon, title, text, the buttons, and the vertical spacers between everything internally. Per Dave's examples, the first example could be the default size, and the second one could be a "s" size. I'd just need to know what specifications you want for everything, or we could just remove the titleSize prop for now and we can implement the size prop later.

Copy link
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 think the spacing looks alright when changing the title size.

};

EuiEmptyPrompt.propTypes = {
iconType: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the iconTypes be imported from EuiIcon?

You can remove parts of the prompt to simplify it, if you wish.
</p>
<p>
You can also provide an array of multiple actions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a sentence here: "Be sure to list primary actions first and secondary actions last."

@cjcenizal
Copy link
Contributor Author

Good catches, @cchaos. Addressed.

@cjcenizal
Copy link
Contributor Author

jenkins test this

@cjcenizal cjcenizal merged commit ae2f7ab into elastic:master May 1, 2018
@cjcenizal cjcenizal deleted the empty-prompt branch May 1, 2018 15:39
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.

4 participants