2024-09-30 15:17:38 -05:00
|
|
|
"use client";
|
|
|
|
|
import Grid from "@mui/material/Grid2";
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
import NumericKey from "@molecules/NumericKey";
|
2024-09-19 19:22:43 -05:00
|
|
|
|
2024-09-30 15:17:38 -05:00
|
|
|
interface NumericPadProps {
|
|
|
|
|
onKeyClick: (key: string) => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const NumericPad: React.FC<NumericPadProps> = ({ onKeyClick }) => {
|
|
|
|
|
const { t } = useTranslation();
|
2024-09-19 19:22:43 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Grid container spacing={0.4} justifyContent="center" alignItems="center">
|
|
|
|
|
<Grid size={{ xs: 6 }}>
|
|
|
|
|
<NumericKey
|
2024-09-30 15:17:38 -05:00
|
|
|
label={t("lbl_cancel")}
|
|
|
|
|
onClick={() => onKeyClick("cancel")}
|
2024-09-19 19:22:43 -05:00
|
|
|
className="h-12 w-full bg-danger-light text-white hover:bg-danger-dark"
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid size={{ xs: 6 }}>
|
|
|
|
|
<NumericKey
|
2024-09-30 15:17:38 -05:00
|
|
|
label={t("lbl_clear")}
|
|
|
|
|
onClick={() => onKeyClick("clear")}
|
|
|
|
|
className="h-12 bg-secondary-light text-black"
|
2024-09-19 19:22:43 -05:00
|
|
|
/>
|
|
|
|
|
</Grid>
|
2024-09-30 15:17:38 -05:00
|
|
|
{[...Array(10).keys()].map((i) => (
|
|
|
|
|
<Grid key={i} size={{ xs: 4 }} sx={{ minWidth: "100px" }}>
|
2024-09-19 19:22:43 -05:00
|
|
|
<NumericKey
|
2024-09-30 15:17:38 -05:00
|
|
|
label={i}
|
|
|
|
|
onClick={() => onKeyClick(i.toString())}
|
|
|
|
|
className="h-16 bg-primary-500 text-white hover:bg-primary-600"
|
2024-09-19 19:22:43 -05:00
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
))}
|
2024-09-30 15:17:38 -05:00
|
|
|
<Grid size={{ xs: 4 }}>
|
2024-09-19 19:22:43 -05:00
|
|
|
<NumericKey
|
|
|
|
|
label="."
|
2024-09-30 15:17:38 -05:00
|
|
|
onClick={() => onKeyClick(".")}
|
|
|
|
|
className="h-16 bg-primary-500 text-white hover:bg-primary-600"
|
2024-09-19 19:22:43 -05:00
|
|
|
/>
|
|
|
|
|
</Grid>
|
2024-09-30 15:17:38 -05:00
|
|
|
<Grid size={{ xs: 4 }}>
|
2024-09-19 19:22:43 -05:00
|
|
|
<NumericKey
|
2024-09-30 15:17:38 -05:00
|
|
|
label={t("lbl_enter")}
|
|
|
|
|
onClick={() => onKeyClick("enter")}
|
2024-09-19 19:22:43 -05:00
|
|
|
className="h-12 w-full bg-success-light text-white hover:bg-success-dark"
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
2024-09-30 15:17:38 -05:00
|
|
|
);
|
|
|
|
|
};
|
2024-09-19 19:22:43 -05:00
|
|
|
|
2024-09-30 15:17:38 -05:00
|
|
|
export default NumericPad;
|