diff --git a/src/Components/Calculator.js b/src/Components/Calculator.js index 02afda4..d7d54d1 100644 --- a/src/Components/Calculator.js +++ b/src/Components/Calculator.js @@ -22,7 +22,7 @@ export default function Calculator(props){ if(typeof content === "number" ){ setMain(prev=>{return prev.toString()+content.toString()}) - }else if(content == "."){ + }else if(content === "."){ //HANDLE DECIMAL WITH REGEX }else if(operations[content]){ setMemory(prev=>{operations[content](prev,main)}) diff --git a/src/Components/NumPad.js b/src/Components/NumPad.js index 5da55db..ace1ae3 100644 --- a/src/Components/NumPad.js +++ b/src/Components/NumPad.js @@ -1,28 +1,32 @@ import Button from "./Button" export default function NumPad(props){ const map = { - zero:{number:0,callback:""}, - one:{number:1,callback:""}, - two:{number:2,callback:""}, - three:{number:3,callback:""}, - four:{number:4,callback:""}, - five:{number:5,callback:""}, - six:{number:6,callback:""}, - seven:{number:7,callback:""}, - eight:{number:8,callback:""}, - nine:{number:9,callback:""} + zero:0, + one:1, + two:2, + three:3, + four:4, + five:5, + six:6, + seven:7, + eight:8, + nine:9 } const numPad = Object.keys(map).map((e,i)=>{ return( - ) }) return( - <> +
{numPad} - +
) } \ No newline at end of file diff --git a/src/Components/Operators.js b/src/Components/Operators.js index a46a4a8..7ee0180 100644 --- a/src/Components/Operators.js +++ b/src/Components/Operators.js @@ -1,19 +1,23 @@ import Button from "./Button"; export default function Operators(props){ const map = { - add:{symbol:"+",callback:""}, - subtract:{symbol:"-",callback:""}, - multiply:{symbol:"x",callback:""}, - divide:{symbol:"/",callback:""}, - decimal:{symbol:".",callback:""} + add:"+", + subtract:"-", + multiply:"x", + divide:"/", + decimal:"." } const operators = Object.keys(map).map(e=>{ - return }) - return ( <>{operators}) + return (
{operators}
) } \ No newline at end of file