diff --git a/craft/src/panels/sitesmith/ChatInput.tsx b/craft/src/panels/sitesmith/ChatInput.tsx new file mode 100644 index 0000000..36d6dde --- /dev/null +++ b/craft/src/panels/sitesmith/ChatInput.tsx @@ -0,0 +1,25 @@ +import React, { useState, KeyboardEvent } from 'react'; + +interface Props { disabled?: boolean; placeholder?: string; onSend: (text: string) => void; } + +export const ChatInput: React.FC = ({ disabled, placeholder, onSend }) => { + const [v, setV] = useState(''); + const fire = () => { const t = v.trim(); if (!t || disabled) return; onSend(t); setV(''); }; + const onKey = (e: KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); fire(); } }; + return ( +
+