summaryrefslogtreecommitdiff
path: root/client/components/Tasks/TaskForm.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/Tasks/TaskForm.jsx')
-rw-r--r--client/components/Tasks/TaskForm.jsx50
1 files changed, 50 insertions, 0 deletions
diff --git a/client/components/Tasks/TaskForm.jsx b/client/components/Tasks/TaskForm.jsx
new file mode 100644
index 0000000..89771ad
--- /dev/null
+++ b/client/components/Tasks/TaskForm.jsx
@@ -0,0 +1,50 @@
+import { h, Component } from 'preact'
+import { Link } from 'react-router-dom'
+
+import client from '../../client.js'
+
+export default class TaskForm extends Component {
+ constructor(props) {
+ super()
+ this.state = {
+ name: '',
+ }
+ this.updateState = this.updateState.bind(this)
+ this.handleSubmit = this.handleSubmit.bind(this)
+ }
+
+ updateState(event){
+ const name = event.target.name
+ let value = event.target.value
+ console.log(name, value)
+ this.setState({
+ [name]: value,
+ error: null,
+ })
+ }
+
+ updateAlpha(event){
+ const name = event.target.name
+ let value = event.target.value
+ console.log(name, value)
+ this.setState({
+ alphaValue: value,
+ alpha: '1e' + value,
+ error: null,
+ })
+ }
+
+ handleSubmit(event) {
+ event.preventDefault()
+ let rec = Object.assign({}, this.state)
+ delete rec.error
+ this.props.onClose()
+ client.folder.create( rec ).then( (data) => {
+ this.props.addFolder( data )
+ })
+ }
+
+ render() {
+ return ( <TaskFormView currentTask={this.state} /> )
+ }
+}