Conversation
fd68b6c to
ecbf86b
Compare
|
@nreese @cchaos OK. I think this thing is mostly done and ready for review. I'm gonna push on doing the range wrapper stuff in a different PR since it'll likely require another component, but the ranges as is work good as separated items. @cchaos feel free to make any visual changes directly to the PR if you want to clean up any styling The props documentation is busted, need to dig in an figure out what's going on there. |
|
@nreese Fixed. Took me longer than I'd care to admit to find the problem. Basically I was trying to replicate a css selector bug in I need to submit a fix to them upstream. |
|
is it possible to have the inline date picker still show the input? |
I think you'd achieve that by passing the datepicker state to a separate |
|
OK. Styley stuff @cchaos mentioned should all be fixed. Gonna leave the classname stuff for now. |
package.json
Outdated
| "prop-types": "^15.6.0", | ||
| "react-ace": "^5.5.0", | ||
| "react-color": "^2.13.8", | ||
| "react-datepicker": "v1.4.0", |
There was a problem hiding this comment.
1.4.1 was released a few days ago. Might as well start out up date.
| } from '../error_boundary'; | ||
|
|
||
| export class EuiDatePicker extends Component { | ||
| constructor(props) { |
There was a problem hiding this comment.
constructor can be removed. state.startDate is never used and handleChange is also never used
| this.handleChange = this.handleChange.bind(this); | ||
| } | ||
|
|
||
| handleChange(date) { |
There was a problem hiding this comment.
handleChange can be removed. It is never used
| // There is no reason to launch the datepicker in its own modal. Can always build these ourselves | ||
| this.props.withPortal | ||
| ) { | ||
| datePickerOrError = ( |
There was a problem hiding this comment.
Instead of overriding datePickerOrError, why not just return error components? Maybe move if statement ahead of date picker definition so code reads like this
if (using unused props) {
return (<div>RTFM</div>)
}
return (
<span className={classes}>
<EuiFormControlLayout>
<EuiValidatableControl>
<DatePicker/>
</EuiValidatableControl>
</EuiFormControlLayout>
</span>
)
|
@snide I figured out why props is failing in docs. |
|
@nreese yessss.... feels good man |
cchaos
left a comment
There was a problem hiding this comment.
Whew! I don't see anything in the code that really sticks out. I would consider commenting about the commented out code either as to why we're not using it and/or why we're keeping it in but commented.
| The passed icon needs to come from our list of svg icons. Can be flipped { | ||
| // eslint-disable-next-line react/no-unescaped-entities | ||
| } to the other side by passing <EuiCode>iconSide="right"</EuiCode>. | ||
| </p> |
There was a problem hiding this comment.
Looks like duplicate description text from the Icon section
|
|
||
|
|
||
| // We use SVG URIs for the navigation arrows. There is one for light and dark. | ||
| @mixin datePicker__arrow { |
There was a problem hiding this comment.
Is this specific to the datepicker or should we make it a general caret + direction mixin?
There was a problem hiding this comment.
It's specific. Normally we have control over the dom and would use an EuiButtonIcon. I'm injecting this into their dom. I don't think we'd ever want to do something like this. I'll make the comment more clear.
There was a problem hiding this comment.
Ok, I know that we have some svg uri stuff in /global_styling/mixins/_icons.scss so I wasn't sure if we wanted to plop this in there too.
| .react-datepicker-popper { | ||
| @include euiBottomShadowMedium; | ||
|
|
||
| border: 1px solid $euiBorderColor; |
There was a problem hiding this comment.
And there's other instances throughout that could be changed as well.
| background: $euiColorLightestShade; | ||
| } | ||
|
|
||
| // If the shadow is on, and it is inline, we need to put the shadow on the datepciker |
| box-shadow: | ||
| 0 0px 12px -1px rgba($euiShadowColor, .2), | ||
| 0 0px 4px -1px rgba($euiShadowColor, .2), | ||
| 0 0px 2px 0 rgba($euiShadowColor, .2) !important; |
There was a problem hiding this comment.
Can you make a shadow mixin for this, I can see reuse.
|
And I still see the custom class stuff in the docs. But other than that. I think it's good to merge! Congrats! |
|
Thanks for the review y'all. |




Summary
Adds a Datepicker to EUI based on
react-datepicker. The SCSS layer has been heavily modified while still keeping the original selectors (with some minor wrapper additions when needed). It works within our form system / validation controls. It removes some unneeded features fromreact-datepickerby spitting out warnings if certain props are used.Status
This is mostly working, but needs some documentation and code cleanup.
withPortal) should properly spit out errors and be excluded from useTODO