-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
/
Array.js
47 lines (41 loc) · 932 Bytes
/
Array.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import PropTypes from 'prop-types';
import React from 'react';
import Textarea from 'react-textarea-autosize';
const styles = {
display: 'table-cell',
boxSizing: 'border-box',
verticalAlign: 'middle',
height: '26px',
width: '100%',
outline: 'none',
border: '1px solid #f7f4f4',
borderRadius: 2,
fontSize: 11,
padding: '5px',
color: '#555',
};
class ArrayType extends React.Component {
render() {
const { knob, onChange } = this.props;
return (
<Textarea
id={knob.name}
ref="input"
style={styles}
value={knob.value.join(knob.separator)}
onChange={e => onChange(e.target.value.split(knob.separator))}
/>
);
}
}
ArrayType.propTypes = {
knob: PropTypes.object,
onChange: PropTypes.func,
};
ArrayType.serialize = function(value) {
return value;
};
ArrayType.deserialize = function(value) {
return value;
};
export default ArrayType;