🚧 More work on React components
This commit is contained in:
parent
e2b5ba2ee7
commit
3d9192a5ae
12 changed files with 178 additions and 132 deletions
|
@ -31,22 +31,22 @@ const PatternOptionPctDegCount = props => {
|
|||
|
||||
const toggleExpanded = () => setExpanded(!expanded);
|
||||
|
||||
const styles = {
|
||||
container: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignItems: "center"
|
||||
},
|
||||
left: {
|
||||
flexGrow: 1,
|
||||
margin: "0 0.5rem"
|
||||
},
|
||||
right: { margin: "0 0.5rem" }
|
||||
};
|
||||
let unit = "";
|
||||
if (props.type === "pct") unit = "%";
|
||||
if (props.type === "deg") unit = "°";
|
||||
|
||||
let option = (
|
||||
<FormFieldSlider
|
||||
name={props.name}
|
||||
value={value}
|
||||
min={props.min}
|
||||
max={props.max}
|
||||
step={props.type === "count" ? 1 : props.step}
|
||||
onChange={update}
|
||||
label={"po-" + props.type + "-" + props.name}
|
||||
updateValue={update}
|
||||
/>)
|
||||
|
||||
return (
|
||||
<li>
|
||||
<OptionPreamble
|
||||
|
@ -65,19 +65,8 @@ const PatternOptionPctDegCount = props => {
|
|||
value: props.name
|
||||
})
|
||||
}
|
||||
option={option}
|
||||
/>
|
||||
{!expanded ? null : (
|
||||
<FormFieldSlider
|
||||
name={props.name}
|
||||
value={value}
|
||||
min={props.min}
|
||||
max={props.max}
|
||||
step={props.type === "count" ? 1 : props.step}
|
||||
onChange={update}
|
||||
label={"po-" + props.type + "-" + props.name}
|
||||
updateValue={update}
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue