refactor: vector

This commit is contained in:
cha0s 2021-01-30 16:06:43 -06:00
parent 70389c501f
commit 654c223253
3 changed files with 15 additions and 10 deletions

View File

@ -27,7 +27,7 @@ const VectorRange = ({
}, },
); );
}} }}
vector={isSingle ? range : range.min} value={isSingle ? range : range.min}
/> />
<label className="vector-range__to-label"> <label className="vector-range__to-label">
@ -61,7 +61,7 @@ const VectorRange = ({
}, },
); );
}} }}
vector={range.max} value={range.max}
/> />
)} )}
</div> </div>

View File

@ -9,11 +9,11 @@ const Vector = ({
integer, integer,
labels, labels,
onChange, onChange,
vector, value,
}) => ( }) => (
<div className="vector"> <div className="vector">
<label> <label>
{labels[0]} <div className="vector__label-text">{labels[0]}</div>
<Number <Number
integer={integer} integer={integer}
onChange={(event, value) => { onChange={(event, value) => {
@ -21,27 +21,27 @@ const Vector = ({
event, event,
[ [
value, value,
vector[1], value[1],
], ],
); );
}} }}
value={vector[0]} value={value[0]}
/> />
</label> </label>
<label> <label>
{labels[1]} <div className="vector__label-text">{labels[1]}</div>
<Number <Number
integer={integer} integer={integer}
onChange={(event, value) => { onChange={(event, value) => {
onChange( onChange(
event, event,
[ [
vector[0], value[0],
value, value,
], ],
); );
}} }}
value={vector[1]} value={value[1]}
/> />
</label> </label>
</div> </div>
@ -77,7 +77,7 @@ Vector.propTypes = {
integer: PropTypes.bool, integer: PropTypes.bool,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
labels: PropTypes.arrayOf(PropTypes.string), labels: PropTypes.arrayOf(PropTypes.string),
vector: vectorPropType.isRequired, value: vectorPropType.isRequired,
}; };
export default Vector; export default Vector;

View File

@ -1,3 +1,8 @@
.vector { .vector {
display: flex; display: flex;
} }
.vector__label-text {
font-size: 0.7em;
margin-right: 0.5em;
}