Add datetime widget
This commit is contained in:
parent
8d63ff0a88
commit
bbbf3c5621
@ -76,6 +76,7 @@
|
||||
"markup-it": "git+https://github.com/cassiozen/markup-it.git",
|
||||
"pluralize": "^3.0.0",
|
||||
"prismjs": "^1.5.1",
|
||||
"react-datetime": "^2.6.0",
|
||||
"react-portal": "^2.2.1",
|
||||
"selection-position": "^1.0.0",
|
||||
"semaphore": "^1.0.5",
|
||||
|
22
src/components/Widgets/DateTimeControl.js
Normal file
22
src/components/Widgets/DateTimeControl.js
Normal 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,
|
||||
};
|
9
src/components/Widgets/DateTimePreview.js
Normal file
9
src/components/Widgets/DateTimePreview.js
Normal file
@ -0,0 +1,9 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
|
||||
export default function StringPreview({ value }) {
|
||||
return <span>{value}</span>;
|
||||
}
|
||||
|
||||
StringPreview.propTypes = {
|
||||
value: PropTypes.node,
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user