-
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
Merged
Merged
Feature/datepicker #644
Changes from 34 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
0049577
start of datepicker
snide 85602b3
update datepicker, now works with form controls
snide f2e0602
more styling
snide ee79117
better timebox
snide f17a930
shadows are optional, inline works
snide 307f523
ranges work
snide fbd5b8c
blacklist certain react-datepicker props, set defaults for others
snide e4b27d0
more props alignment
snide d2fc347
cleanup css / prop layer
snide 8391215
docs for states and locale
snide 231dfc7
time selection docs
snide 7b2ce38
validation examples
snide 59b67ff
min and max times
snide a44b912
excluding date / time docs
snide 5858ca6
cleaning up examples
snide cd6ea5b
more documentation
snide 5ce2f64
custom inputs
snide 84086fc
some responsive adjustments for mobile
snide 96516eb
cleanup sass, fix errors
snide bebacf0
fix some bad vars
snide 781854f
utc offset docs
snide 4878220
cleanup
snide 6989e70
filter dates and ranges
snide a85b32e
clean up date range
snide 194d9ce
alphabatize props
snide 86944e1
fix stupid selector bug
snide aab86a4
remove form mixins
snide a072962
comments
snide 1740893
address design feedback
snide f0eb713
fix goofy border with a box shadow
snide 19e67ba
use clock icon if only time select, format date properly
snide 968e1b6
clean up some more styling, address feedback
snide 96fd063
make time picker dropdown look similar to combo box
snide aef7b8d
more time only styling
snide 1e53815
update to react-datepicker@1.4.1
snide cab7fb4
remove constructor, address feedback
snide 1ec01ac
clean up the way errors are returned
snide 3ffc72b
fix props doc error, add props docs
snide d68e2f6
changelog
snide 43826fc
address feedback
snide ca03480
pesky outline
snide 9d22f33
docs and borders
snide File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React, { | ||
Component, | ||
} from 'react'; | ||
|
||
import moment from 'moment'; | ||
|
||
import { | ||
EuiDatePicker, | ||
EuiFormRow, | ||
EuiSpacer, | ||
} from '../../../../src/components'; | ||
|
||
export default class extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
startDate: moment() | ||
}; | ||
|
||
this.handleChange = this.handleChange.bind(this); | ||
} | ||
|
||
handleChange(date) { | ||
this.setState({ | ||
startDate: date | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<EuiFormRow label="className example"> | ||
<EuiDatePicker | ||
selected={this.state.startDate} | ||
showTimeSelect | ||
onChange={this.handleChange} | ||
className="dpTest__purpleInput" | ||
/> | ||
</EuiFormRow> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiFormRow label="calendarClassName example"> | ||
<EuiDatePicker | ||
selected={this.state.startDate} | ||
showTimeSelect | ||
onChange={this.handleChange} | ||
calendarClassName="dpTest__purpleCal" | ||
/> | ||
</EuiFormRow> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiFormRow label="dayClassName example"> | ||
<EuiDatePicker | ||
selected={this.state.startDate} | ||
showTimeSelect | ||
onChange={this.handleChange} | ||
dayClassName={date => date.date() < Math.random() * 31 ? 'dpTest__purpleDay' : undefined} | ||
/> | ||
</EuiFormRow> | ||
|
||
<EuiSpacer size="m" /> | ||
|
||
<EuiFormRow label="popperClassName example"> | ||
<EuiDatePicker | ||
selected={this.state.startDate} | ||
showTimeSelect | ||
onChange={this.handleChange} | ||
popperClassName="dpTest__purplePopper" | ||
/> | ||
</EuiFormRow> | ||
|
||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { | ||
Component, | ||
} from 'react'; | ||
|
||
import PropTypes from 'prop-types'; | ||
|
||
import moment from 'moment'; | ||
|
||
import { | ||
EuiDatePicker, | ||
EuiButton, | ||
} from '../../../../src/components'; | ||
|
||
// Should be a component because the datepicker does some ref stuff behind the scenes | ||
// eslint-disable-next-line react/prefer-stateless-function | ||
class ExampleCustomInput extends React.Component { | ||
|
||
render () { | ||
return ( | ||
<EuiButton | ||
className="example-custom-input" | ||
onClick={this.props.onClick} | ||
> | ||
{this.props.value} | ||
</EuiButton> | ||
) | ||
} | ||
} | ||
|
||
ExampleCustomInput.propTypes = { | ||
onClick: PropTypes.func, | ||
value: PropTypes.string | ||
}; | ||
|
||
// eslint-disable-next-line react/no-multi-comp | ||
export default class extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
startDate: moment() | ||
}; | ||
|
||
this.handleChange = this.handleChange.bind(this); | ||
} | ||
|
||
handleChange(date) { | ||
this.setState({ | ||
startDate: date | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<EuiDatePicker | ||
selected={this.state.startDate} | ||
onChange={this.handleChange} | ||
customInput={<ExampleCustomInput />} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { | ||
Component, | ||
} from 'react'; | ||
|
||
import moment from 'moment'; | ||
|
||
import { | ||
EuiDatePicker, | ||
EuiFormRow, | ||
} from '../../../../src/components'; | ||
|
||
export default class extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
startDate: moment() | ||
}; | ||
|
||
this.handleChange = this.handleChange.bind(this); | ||
} | ||
|
||
handleChange(date) { | ||
this.setState({ | ||
startDate: date | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<EuiFormRow label="Select a date"> | ||
<EuiDatePicker | ||
selected={this.state.startDate} | ||
onChange={this.handleChange} | ||
/> | ||
</EuiFormRow> | ||
); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.