Skip to content

[EuiDatePicker] Add right padding to account for clear icon#5095

Merged
cee-chen merged 4 commits intoelastic:masterfrom
cee-chen:datepicker-clearicon
Aug 26, 2021
Merged

[EuiDatePicker] Add right padding to account for clear icon#5095
cee-chen merged 4 commits intoelastic:masterfrom
cee-chen:datepicker-clearicon

Conversation

@cee-chen
Copy link
Copy Markdown
Contributor

@cee-chen cee-chen commented Aug 25, 2021

Summary

closes #5082

Before

Currently, there's no padding/spacing set to account for the "clear" icon on EuiDatePicker (which appears when an onClear function is passed):

After

The solution I went with was mimicking the padding set for the left icon, and adding a new withClear class that sets a mirrored right padding if onClear is present and if a date has been selected):

Checklist

QA testing note: You have to manipulate the current "Clearable" DatePicker example to test this. Inspect the input, go up to the parent .euiFormControlLayout, and set an inline style of width: 200px;.

  • 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 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

- Should only appear when `onClear` is passed, and if a date is present (`selected`)
@cee-chen cee-chen requested a review from cchaos August 25, 2021 21:00
@cee-chen
Copy link
Copy Markdown
Contributor Author

@cchaos I'm not sure how many scenarios we anticipate having small date pickers in, but I'm actually wondering if there's now too much padding on the right and if it's making the text harder to read 😅

I'm wondering if instead of using the @euiFormControlWithIcon mixin, I should just use a custom $euiSize based multiplier that comes out to a slightly smaller width?

If you don't see any issues with it though, then no worries!

@kibanamachine
Copy link
Copy Markdown

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

@cchaos
Copy link
Copy Markdown
Contributor

cchaos commented Aug 25, 2021

I'm wondering if instead of using the @euiFormControlWithIcon mixin, I should just use a custom $euiSize based multiplier that comes out to a slightly smaller width?

Mainly it's about consistency and maintenance. I'd rather keep using the mixin and decide if, overall, we should just reduce that padding. But let's not break it from the norm in this PR.

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.

Implementation is great and fixed the problem!

My following suggestions are just some good patterns we follow.

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
@kibanamachine
Copy link
Copy Markdown

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

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.

LGTM! Thanks for the quick fix!

@cee-chen cee-chen enabled auto-merge (squash) August 26, 2021 15:31
@cee-chen
Copy link
Copy Markdown
Contributor Author

Thank you for the super easy code suggestions! 🎉

@kibanamachine
Copy link
Copy Markdown

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

@cee-chen cee-chen merged commit e07da8b into elastic:master Aug 26, 2021
@cee-chen cee-chen deleted the datepicker-clearicon branch September 1, 2021 18:42
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.

[EuiDatePickerRange] [EuiDatePicker] Clear buttons on inputs hide selected time

3 participants