This repository has been archived on 2025-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
tasky/src/components/input.js
2022-01-29 14:36:53 +01:00

40 lines
1.0 KiB
JavaScript

import React from 'react';
class Input extends React.Component {
read(e){
this.props.update(this.props.id, e.target.value)
}
render(){
switch (this.props.type) {
case 'submit':
return <input
key={this.props.key}
type="submit"
value={this.props.lable}
onClick={this.props.submit} />
case 'range':
let range = this.props.range.split(':')
return <input
key={this.props.key}
type="range"
min={range[0]}
max={range[1]}
step={range[2]}
onChange={this.read.bind(this)}
value={this.props.value} />
default:
return <input
key={this.props.key}
type={this.props.type}
placeholder={this.props.lable}
onChange={this.read.bind(this)}
value={this.props.value} />
}
}
}
export default Input;