2023-07-04 11:15:57 +00:00
|
|
|
import Button from "./Button"
|
|
|
|
export default function NumPad(props){
|
|
|
|
const map = {
|
2023-07-04 15:26:43 +00:00
|
|
|
zero:0,
|
|
|
|
one:1,
|
|
|
|
two:2,
|
|
|
|
three:3,
|
|
|
|
four:4,
|
|
|
|
five:5,
|
|
|
|
six:6,
|
|
|
|
seven:7,
|
|
|
|
eight:8,
|
2023-07-05 18:03:52 +00:00
|
|
|
nine:9,
|
|
|
|
add:"+",
|
|
|
|
subtract:"-",
|
|
|
|
multiply:"x",
|
|
|
|
divide:"/",
|
|
|
|
decimal:"."
|
2023-07-04 11:15:57 +00:00
|
|
|
}
|
|
|
|
const numPad = Object.keys(map).map((e,i)=>{
|
|
|
|
return(
|
2023-07-04 15:26:43 +00:00
|
|
|
<Button
|
|
|
|
id={e}
|
|
|
|
content={map[e]}
|
|
|
|
key={"numPad"+e}
|
|
|
|
handleInput={props.handleInput}>
|
2023-07-04 11:15:57 +00:00
|
|
|
{i}
|
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
return(
|
2023-07-04 15:26:43 +00:00
|
|
|
<div className="numPad">
|
2023-07-04 11:15:57 +00:00
|
|
|
{numPad}
|
2023-07-04 15:26:43 +00:00
|
|
|
</div>
|
2023-07-04 11:15:57 +00:00
|
|
|
)
|
|
|
|
}
|