"use client";
import React, { InputHTMLAttributes } from "react";
import style from "./QuestionInput.module.css";
import classNames from "classnames";

interface QuestionInputProps extends InputHTMLAttributes<HTMLInputElement> {
    error?: string;
    label?: string;
}

export default function QuestionInput({ error, label, className, ...props }: QuestionInputProps) {
    return (
        <div className={style.inputWrapper}>
            {label && <label className={style.label}>{label}</label>}
            <input 
                className={`${style.bigInput} ${error ? style.hasError : ''} ${className || ''}`}
                {...props}
            />
            {error && <div className={style.errorText}>{error}</div>}
        </div>
    );
}
