-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 customCloseIcon prop #356
Conversation
src/components/DateRangePicker.jsx
Outdated
@@ -273,7 +277,9 @@ export default class DateRangePicker extends React.Component { | |||
<span className="screen-reader-only"> | |||
{this.props.phrases.closeDatePicker} | |||
</span> | |||
<CloseButton /> | |||
<div className="DateRangePickerInput__close"> |
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.
This class name is wrong. You're not inside the input.
stories/DateRangePicker_input.js
Outdated
padding: '3px', | ||
}} | ||
> | ||
{'X'} |
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.
This can just be X
no?
showClearDates | ||
customCloseIcon={<span className="custom-close-icon" />} | ||
/>); | ||
expect(wrapper.find('.DateRangePickerInput__calendar-icon .custom-close-icon')); |
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.
This should fail... why would it be under .DateRangePickerInput__calendar-icon
? Why isn't this failing?
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.
I'm concerned about the test, plus we need parallel tests for the SingleDatePicker
components.
48e136c
to
09fd248
Compare
f30d5fb
to
3f95071
Compare
@majapw I've added a corresponding spec for SingleDatePicker. The spec you pointed out wasn't failing because it accidentally didn't have any assertions, only a dangling |
showClearDates | ||
customCloseIcon={<span className="custom-close-icon" />} | ||
/>); | ||
expect(wrapper.find('.DateRangePickerInput__calendar-icon .custom-close-icon')); |
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.
You now have the same problem here in this spec...
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.
Oops, fixed
0a31762
to
6d45150
Compare
Correct me if I'm wrong, but shouldn't this whole thing rather be called "custom CLEAR icon"? |
It closes the datepicker, it doesn't clear the dates. |
It actually does both... We overload the icon in use, so uh, I get the Q |
Lol well there you go |
@majapw can we unoverload them? |
I ran into the same issue as @zeemawn. I spent a good couple hours thinking that I could add a custom close icon to the default state, only to find out that it was only implemented for the |
@majapw @ljharb
Adds a
customCloseIcon
prop to allow overriding the default<CloseButton />
. I matched the behavior ofcustomArrowIcon
: default prop of null, fallback to original component insiderender
, and a wrapping css class.