Spaces:
Running
Running
Upload components/QuickNumberPad.jsx with huggingface_hub
Browse files
components/QuickNumberPad.jsx
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { Minus, Plus, Check, X } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const QuickNumberPad = ({
|
| 5 |
+
onNumberClick,
|
| 6 |
+
onClear,
|
| 7 |
+
onBackspace,
|
| 8 |
+
onEnter,
|
| 9 |
+
displayValue,
|
| 10 |
+
showClear = true,
|
| 11 |
+
showBackspace = true
|
| 12 |
+
}) => {
|
| 13 |
+
return (
|
| 14 |
+
<div className="grid grid-cols-3 gap-2 max-w-[250px] mx-auto">
|
| 15 |
+
{[1, 2, 3, 4, 5, 6, 7, 8, 9].map((num) => (
|
| 16 |
+
<button
|
| 17 |
+
key={num}
|
| 18 |
+
onClick={() => onNumberClick(num.toString())}
|
| 19 |
+
className="h-12 bg-white border border-pos-border rounded-xl hover:bg-primary-50 hover:border-primary-300 hover:text-primary-600 transition-all font-bold text-lg"
|
| 20 |
+
>
|
| 21 |
+
{num}
|
| 22 |
+
</button>
|
| 23 |
+
))}
|
| 24 |
+
|
| 25 |
+
{showClear && (
|
| 26 |
+
<button
|
| 27 |
+
onClick={onClear}
|
| 28 |
+
className="h-12 bg-danger/10 text-danger border border-danger/20 rounded-xl hover:bg-danger hover:text-white transition-all font-medium"
|
| 29 |
+
>
|
| 30 |
+
ล้าง
|
| 31 |
+
</button>
|
| 32 |
+
)}
|
| 33 |
+
|
| 34 |
+
<button
|
| 35 |
+
onClick={() => onNumberClick('0')}
|
| 36 |
+
className="h-12 bg-white border border-pos-border rounded-xl hover:bg-primary-50 hover:border-primary-300 hover:text-primary-600 transition-all font-bold text-lg"
|
| 37 |
+
>
|
| 38 |
+
0
|
| 39 |
+
</button>
|
| 40 |
+
|
| 41 |
+
{showBackspace && (
|
| 42 |
+
<button
|
| 43 |
+
onClick={onBackspace}
|
| 44 |
+
className="h-12 bg-warning/10 text-warning border border-warning/20 rounded-xl hover:bg-warning hover:text-white transition-all"
|
| 45 |
+
>
|
| 46 |
+
<Minus className="w-5 h-5 mx-auto" />
|
| 47 |
+
</button>
|
| 48 |
+
)}
|
| 49 |
+
|
| 50 |
+
<button
|
| 51 |
+
onClick={onEnter}
|
| 52 |
+
className="h-12 bg-success text-white border border-success rounded-xl hover:bg-success/90 transition-all flex items-center justify-center"
|
| 53 |
+
>
|
| 54 |
+
<Check className="w-6 h-6" />
|
| 55 |
+
</button>
|
| 56 |
+
</div>
|
| 57 |
+
);
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
export default QuickNumberPad;
|