Make input SFC

pull/10616/head
Andrew Watkins 2017-08-22 13:51:30 -07:00
parent 901717ba76
commit 0f1a9a4d92
2 changed files with 44 additions and 23 deletions

View File

@ -1,6 +1,7 @@
import React, {PropTypes} from 'react'
import OptIn from 'shared/components/OptIn'
import Input from 'src/data_explorer/components/DisplayOptionsInput'
const AxesOptions = ({
axes: {y: {bounds, label, prefix, suffix, base, defaultYLabel}},
@ -43,30 +44,22 @@ const AxesOptions = ({
type="number"
/>
</div>
<Input
name="prefix"
id="prefix"
value={prefix}
labelText="Y-Value's Prefix"
onChange={onSetPrefixSuffix}
/>
<Input
name="suffix"
id="suffix"
value={suffix}
labelText="Y-Value's Suffix"
onChange={onSetPrefixSuffix}
/>
<div className="form-group col-sm-6">
<label htmlFor="prefix">Y-Value's Prefix</label>
<input
className="form-control input-sm"
type="text"
name="prefix"
id="prefix"
value={prefix}
onChange={onSetPrefixSuffix}
/>
</div>
<div className="form-group col-sm-6">
<label htmlFor="prefix">Y-Value's Suffix</label>
<input
className="form-control input-sm"
type="text"
name="suffix"
id="suffix"
value={suffix}
onChange={onSetPrefixSuffix}
/>
</div>
<div className="form-group col-sm-6">
<label>Labels Format</label>
<label>Y-Value Format</label>
<ul className="nav nav-tablist nav-tablist-sm">
<li
className={base === '10' ? 'active' : ''}

View File

@ -0,0 +1,28 @@
import React, {PropTypes} from 'react'
const DisplayOptionsInput = ({id, name, value, onChange, labelText}) =>
<div className="form-group col-sm-6">
<label htmlFor={name}>
{labelText}
</label>
<input
className="form-control input-sm"
type="text"
name={name}
id={id}
value={value}
onChange={onChange}
/>
</div>
const {func, string} = PropTypes
DisplayOptionsInput.propTypes = {
name: string.isRequired,
id: string.isRequired,
value: string.isRequired,
onChange: func.isRequired,
labelText: string,
}
export default DisplayOptionsInput