-
Notifications
You must be signed in to change notification settings - Fork 841
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
[EuiRangeLevels] Align ticks and levels #5181
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_5181/ |
I probably should have mentioned this in the issue before work got started, but I'd like to take a step back to "redesign" this idea of levels. The main problem is that we have a min/max value to provide for each, which means that the levels never really encompass that number (not visually anyhow). This can be confusing if the consumer did not also provide extra context. So the question is, is this just an implementation detail and we need to change the docs so that the custom ticks live within the levels or do we find a way to ensure they overlap the values provided (even if the values literally overlap, i.e. And then just a general note about "design"... Should we consider replacing the track with the levels instead of trying to show beneath it? At least in the single range version? |
I'm glad you brought this up and there's no rush (IMO) to get the current bug fixed. So I can pause this for the moment. |
Yep! I totally agree that the ambiguity around inclusivity is the main issue here. We could establish that const levels = [
{
min: 0,
max: 25,
color: 'primary',
},
{
min: 25,
max: 50,
color: 'success',
},
{
min: 50,
max: 90,
color: 'warning',
},
{
min: 90,
max: 100,
color: 'danger',
},
]; Similarly as: const levels = [
{
min: 0,
color: 'primary',
},
{
min: 25,
color: 'success',
},
{
min: 50,
color: 'warning',
},
{
min: 90,
color: 'danger',
},
]; Where each level then starts at that minimum making the previous one (if exists) stop 1 const levels = [
{
min: 0,
color: 'primary',
},
{
min: 25,
color: 'success',
},
{
min: 50,
max: 60,
color: 'warning',
},
{
min: 90,
max: 95,
color: 'danger',
},
]; Would look something like: |
Or honestly just looking at that design, the levels bar could really just reuse the color stops component instead of trying to chunk it. That may also make the calculations easier? |
IMO we should merge this fix once #5171 is merged. As we can see here, the levels don't look good and we're just fixing what consumers are currently using. After that, we can redesign or reuse the color stops but I guess this will take time and for now, we just make the levels alignment make more sense. Let me know if you both agree in merging this PR. |
I'd be ok with merging this patch and rethinking the design in a separate effort, especially if we want to explore the idea to "reuse the color stops component" or alter the DOM in a significant way. |
This reverts commit 29dd4e5.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5181/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @thompsongl,
Tested in Chrome, Safari, Edge and Firefox, and LGTM! 🎉
Preview documentation changes for this PR: https://eui.elastic.co/pr_5181/ |
Summary
Waiting for #5171 to merge so we have relevant docsCloses #5172. Aligns the gaps between levels and associated ticks. Alignment may still be off by 1px or so, but much improved.
Note that the snapshot tests are less relevant now because we rely on calculable width, which jsdom does not do well.
We should look to Cypress for better tests.
Checklist
- [ ] Checked in mobile- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation