Add datetime widget

This commit is contained in:
Mathias Biilmann Christensen
2016-09-11 23:07:48 +02:00
parent 8d63ff0a88
commit bbbf3c5621
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import React, { PropTypes } from 'react';
import DateTime from 'react-datetime';
export default class DateTimeControl extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(datetime) {
this.props.onChange(datetime);
}
render() {
return <DateTime value={this.props.value || new Date()} onChange={this.handleChange}/>;
}
}
DateTimeControl.propTypes = {
onChange: PropTypes.func.isRequired,
value: PropTypes.node,
};

View File

@ -0,0 +1,9 @@
import React, { PropTypes } from 'react';
export default function StringPreview({ value }) {
return <span>{value}</span>;
}
StringPreview.propTypes = {
value: PropTypes.node,
};