-
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
Feature/datepicker #644
Feature/datepicker #644
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. |
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.
looking great
package.json
Outdated
@@ -42,6 +42,7 @@ | |||
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
lgtm
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this specific to the datepicker or should we make it a general caret + direction mixin?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use $euiBorderThin here?
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.
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 |
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.
datepicker typo
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-datepicker
by 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