"use client"; import { useState, useRef, type KeyboardEvent } from "react"; interface QuestionInputProps { onSubmit: (question: string) => void; disabled?: boolean; } const EXAMPLES = [ "What is Universal Grammar?", "How did Chomsky critique behaviorism?", "Compare Principles and Parameters with Minimalism.", "How did Chomsky's views on language acquisition evolve over time?", "What is Chomsky's theory of propaganda?", ]; export default function QuestionInput({ onSubmit, disabled }: QuestionInputProps) { const [value, setValue] = useState(""); const textareaRef = useRef(null); const handleSubmit = () => { const trimmed = value.trim(); if (!trimmed || disabled) return; onSubmit(trimmed); }; const handleKeyDown = (e: KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); handleSubmit(); } }; const handleExample = (q: string) => { setValue(q); textareaRef.current?.focus(); }; return (
{/* Input box */}