mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
commit
e01c258c07
@ -35,13 +35,13 @@ interface InputProps {
|
|||||||
|
|
||||||
interface InputState {
|
interface InputState {
|
||||||
isFocused: boolean
|
isFocused: boolean
|
||||||
startDate?: Date
|
dateCreated?: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Input extends PureComponent<InputProps, InputState> {
|
export default class Input extends PureComponent<InputProps, InputState> {
|
||||||
public state: InputState = {
|
public state: InputState = {
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
startDate: new Date()
|
dateCreated: new Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
public inputWrapClasses() {
|
public inputWrapClasses() {
|
||||||
@ -62,8 +62,15 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
|
|
||||||
private handleDateChange = (date: Date) => {
|
private handleDateChange = (date: Date) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
startDate: date
|
dateCreated: date
|
||||||
})
|
})
|
||||||
|
const event = {
|
||||||
|
currentTarget: {
|
||||||
|
name: 'dateCreated',
|
||||||
|
value: date
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.props.onChange!(event as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputComponent = () => {
|
public InputComponent = () => {
|
||||||
@ -151,8 +158,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
return (
|
return (
|
||||||
<div className={wrapClass}>
|
<div className={wrapClass}>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
selected={this.state.startDate}
|
selected={this.state.dateCreated}
|
||||||
// TODO: this needs to be able to receive this.props.onChange too
|
|
||||||
onChange={this.handleDateChange}
|
onChange={this.handleDateChange}
|
||||||
className={styles.input}
|
className={styles.input}
|
||||||
onFocus={this.toggleFocus}
|
onFocus={this.toggleFocus}
|
||||||
|
Loading…
Reference in New Issue
Block a user