random fixes.
This commit is contained in:
parent
bd9aebfa61
commit
2b1ded36be
16095
equations/package-lock.json
generated
Normal file
16095
equations/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ function EditorControls(p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function EquationGroup(p) {
|
function EquationGroup(p) {
|
||||||
const {equation,setEquation,data,arr,key,id} = p
|
const {equation,setEquation,data,arr,id} = p
|
||||||
|
|
||||||
const [myArr,setMyArr] = useState(arr)
|
const [myArr,setMyArr] = useState(arr)
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ function EquationGroup(p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function EquationOperator(p) {
|
function EquationOperator(p) {
|
||||||
const {equation,setEquation,data,operator,key,id} = p
|
const {equation,setEquation,operator,id} = p
|
||||||
|
|
||||||
const [op,setOp] = useState(operator)
|
const [op,setOp] = useState(operator)
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ function EquationOperator(p) {
|
|||||||
setEquation(eqArr)
|
setEquation(eqArr)
|
||||||
},[op])
|
},[op])
|
||||||
|
|
||||||
return <div style={{position:"relative",display:"inline-block",paddingLeft:"12px",paddingRight:"12px",paddingTop:"10px"}}><select style={{fontSize:"24px"}} value={op} defaultValue={operator} onChange={(ev)=>{setOp(ev.currentTarget.value)}}>
|
return <div style={{position:"relative",display:"inline-block",paddingLeft:"12px",paddingRight:"12px",paddingTop:"10px"}}><select style={{fontSize:"24px"}} value={op} onChange={(ev)=>{setOp(ev.currentTarget.value)}}>
|
||||||
{["+","-","×","÷","^"].map((sign)=><option key={sign} value={sign}>{sign}</option>)}
|
{["+","-","×","÷","^"].map((sign)=><option key={sign} value={sign}>{sign}</option>)}
|
||||||
</select>
|
</select>
|
||||||
<EditorControls equation={equation} setEquation={setEquation} id={id}/>
|
<EditorControls equation={equation} setEquation={setEquation} id={id}/>
|
||||||
@ -85,7 +85,7 @@ function EquationOperator(p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function EquationValue(p) {
|
function EquationValue(p) {
|
||||||
const {equation,setEquation,data,val,key,id} = p
|
const {equation,setEquation,data,val,id} = p
|
||||||
|
|
||||||
const [item,setItem] = useState(val)
|
const [item,setItem] = useState(val)
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ function EquationValue(p) {
|
|||||||
},[item])
|
},[item])
|
||||||
|
|
||||||
return <div style={{position:"relative",display:"inline-block",border:"1px solid black",paddingTop:"16px"}}>
|
return <div style={{position:"relative",display:"inline-block",border:"1px solid black",paddingTop:"16px"}}>
|
||||||
<select value={item} defaultValue={val} onChange={(ev)=>{setItem(ev.currentTarget.value)}}>
|
<select value={item} onChange={(ev)=>{setItem(ev.currentTarget.value)}}>
|
||||||
{Object.keys(data).map((key)=><option key={key} value={key}>{key}</option>)}
|
{Object.keys(data).map((key)=><option key={key} value={key}>{key}</option>)}
|
||||||
</select>
|
</select>
|
||||||
<br/>
|
<br/>
|
||||||
@ -180,6 +180,8 @@ function Equation(p) {
|
|||||||
|
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<h1>{SolveEquation(equation).toFixed(2)}</h1>
|
<h1>{SolveEquation(equation).toFixed(2)}</h1>
|
||||||
|
<br/><br/>
|
||||||
|
{JSON.stringify(equation)}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +194,7 @@ function EditBox(p) {
|
|||||||
setVal(v)
|
setVal(v)
|
||||||
},[v])
|
},[v])
|
||||||
|
|
||||||
return <input type="text" value={v} defaultValue={val} onChange={(ev)=>{setV(ev.currentTarget.value)}}/>
|
return <input type="text" value={v} onChange={(ev)=>{setV(ev.currentTarget.value)}}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
function ValueEditor(p) {
|
function ValueEditor(p) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user