Skip to content

[EuiEmptyPrompt] Allow horizontal image to be smaller than 50% and added a gap#5663

Merged
cchaos merged 6 commits intoelastic:mainfrom
cchaos:empty_prompt/horizontal_adjustments
Mar 2, 2022
Merged

[EuiEmptyPrompt] Allow horizontal image to be smaller than 50% and added a gap#5663
cchaos merged 6 commits intoelastic:mainfrom
cchaos:empty_prompt/horizontal_adjustments

Conversation

@cchaos
Copy link
Contributor

@cchaos cchaos commented Feb 24, 2022

In Shared UX, we just re-created the NoDataViews component to use the new horizontal EuiEmptyPrompt pattern:

Screen Shot 2022-02-24 at 15 00 20 PM

But as you can see, because the image is always forced to be 50% of the container width, it breaks the title text where we don't want it to. In the PR, we ended up forcing (!important) a max-width to a fixed number based on the content. This isn't ideal or flexible.

Ideally, we'd allow the image to be any size, only max setting it to 50%. That's what I've done in this PR. It still ensures the left side's max-width is the same $euiTextConstrainedMaxWidth so that text shouldn't grow indefinitely.

Before (I've highlighted the image region for better visibility)
Screen Shot 2022-02-24 at 14 50 43 PM

After
Screen Shot 2022-02-24 at 14 50 35 PM

Example with Kibana's text
Screen Shot 2022-02-24 at 14 57 23 PM


I also noticed that there was no margin between the left and right side content so if the image has full color to it's bounds it would touch the text. So I added a gap size equal to the specified padding. This was especially evident in the mobile version:

Before
Screen Shot 2022-02-24 at 14 50 13 PM

After
Screen Shot 2022-02-24 at 14 50 26 PM

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 and playground toggles
  • [ ] Added documentation
  • [ ] Checked Code Sandbox works for any docs examples
  • [ ] Added or updated jest and cypress 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

@cchaos
Copy link
Contributor Author

cchaos commented Feb 24, 2022

I did just realize the image could now get really small before the responsive styles kicked in so I added a 1/3 min-width to the image. 🤷‍♀️ It's still mostly prioritizing the text, which is good, but it does seem awkward. Open to suggestions...
Screen Shot 2022-02-24 at 15 46 20 PM

@kibanamachine
Copy link

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

1 similar comment
@kibanamachine
Copy link

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

Copy link
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.

LGTM! 🎉

I just have a few suggestions.

<>
<EuiEmptyPrompt
icon={<EuiImage size="fullWidth" src={illustration} alt="" />}
icon={<EuiImage size="l" src={illustration} alt="" />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
icon={<EuiImage size="l" src={illustration} alt="" />}
icon={<EuiImage size="fullWidth" src={illustration} alt="" />}

The other illustrations have the size "fullWidth". Also we're saying in our docs:

Screenshot 2022-03-01 at 11 17 53

Comment on lines 94 to 97
@include euiBreakpoint('l', 'xl') {
padding: $euiSizeL 0;
min-width: 33%;
max-width: 50%;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I did just realize the image could now get really small before the responsive styles kicked in so I added a 1/3 min-width to the image. 🤷‍♀️ It's still mostly prioritizing the text, which is good, but it does seem awkward. Open to suggestions...

What if instead of a min-width: 33%; we change it to min-width: 40%;?

empty-prompt-horizontal@2x

@cchaos cchaos enabled auto-merge (squash) March 2, 2022 19:29
@kibanamachine
Copy link

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

@cchaos cchaos merged commit 2c343a4 into elastic:main Mar 2, 2022
@cchaos cchaos deleted the empty_prompt/horizontal_adjustments branch March 4, 2022 03:38
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.

3 participants