'use client'; import React from 'react'; import { SAMPLE_QUESTIONS } from '@/lib/mockData'; interface QuestionInputProps { onSubmit: (question: string) => void; isLoading?: boolean; onSampleQuestion?: (q: string) => void; showWelcome?: boolean; } export function QuestionInput({ onSubmit, isLoading, onSampleQuestion, showWelcome }: QuestionInputProps) { const [value, setValue] = React.useState(''); const textareaRef = React.useRef(null); const handleSubmit = () => { const q = value.trim(); if (!q || isLoading) return; onSubmit(q); setValue(''); if (textareaRef.current) { textareaRef.current.style.height = 'auto'; } }; const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSubmit(); } }; const handleInput = () => { const el = textareaRef.current; if (el) { el.style.height = 'auto'; el.style.height = Math.min(el.scrollHeight, 140) + 'px'; } }; return (
{/* Document scope indicator */}
IR Docs