compro-mit/src/components/ui/TextAreaInput.tsx
fadilkun45 7b4b955c99 feat: add contact form and API integration
- Implemented a contact form with validation and submission functionality.
- Added a dummy API endpoint for contact form submissions.
- Integrated Axios for API requests and error handling.
- Updated UI components for input handling and error display.
- Added toast notifications for user feedback on form submission.
- Included WhatsApp bubble component for enhanced user interaction.
- Updated layout to include new contact page and components.
- Added Docker support for development and production environments.
- Created Makefile for easier deployment and management of Docker containers.
2026-09-04 14:58:16 +07:00

46 lines
1.2 KiB
TypeScript

const spanClasses: Record<number, string> = {
1: "md:col-span-1",
2: "md:col-span-2",
};
const fieldClass = (isError?: boolean) =>
`w-full rounded-lg p-3 text-sm border outline-none text-title placeholder:text-body md:text-base resize-none md:min-h-35 ${isError ? "border-red-500 bg-red-50/40" : "border-border focus:border-primary-600"}`;
export default function TextareaInput({
label,
name,
value,
onChange,
placeholder,
isDisable,
isError,
textFoot,
colSpan = 1,
rows = 5,
}: {
label?: string;
name: string;
value?: string;
onChange: (value: string) => void;
placeholder?: string;
isDisable?: boolean;
isError?: boolean;
textFoot?: string;
colSpan?: number;
rows?: number;
}) {
return (
<div className={`flex flex-col gap-1 ${spanClasses[colSpan] || "md:col-span-1"}`}>
{label && (
<label htmlFor={name} className="text-sm text-subtitle md:text-base">
{label}
</label>
)}
<textarea id={name} name={name} rows={rows} value={value || ""} onChange={(evt) => onChange(evt?.target?.value)} placeholder={placeholder} disabled={isDisable} className={fieldClass(isError)} />
{textFoot && <p className="text-[13px] text-red-500">{textFoot}</p>}
</div>
);
}