Spaces:
Runtime error
Runtime error
Upload components/TmaInput.tsx with huggingface_hub
Browse files- components/TmaInput.tsx +28 -0
components/TmaInput.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
interface TmaInputProps {
|
| 4 |
+
label?: string;
|
| 5 |
+
value: string;
|
| 6 |
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
| 7 |
+
placeholder?: string;
|
| 8 |
+
type?: 'text' | 'number' | 'password';
|
| 9 |
+
error?: string;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
export default function TmaInput({ label, value, onChange, placeholder, type = 'text', error }: TmaInputProps) {
|
| 13 |
+
return (
|
| 14 |
+
<div className="flex flex-col gap-1.5 mb-4">
|
| 15 |
+
{label && <label className="text-sm font-medium text-tg-textSecondary">{label}</label>}
|
| 16 |
+
<input
|
| 17 |
+
type={type}
|
| 18 |
+
value={value}
|
| 19 |
+
onChange={onChange}
|
| 20 |
+
placeholder={placeholder}
|
| 21 |
+
className={`w-full px-4 py-3 rounded-lg border-2 border-tg-border focus:border-tg-secondary focus:outline-none transition-colors ${
|
| 22 |
+
error ? 'border-red-500' : ''
|
| 23 |
+
}`}
|
| 24 |
+
/>
|
| 25 |
+
{error && <span className="text-xs text-red-500">{error}</span>}
|
| 26 |
+
</div>
|
| 27 |
+
);
|
| 28 |
+
}
|